Hi Simran,

Your answer was already very helpful. Thanks for that!

I have another question regarding the Collect.

I have a rating value stored in each "rated" edge in the ratedGraph.
I am trying to multiply the count by the particular rating weight.

Something like this:

FOR u IN users
    LET genreStats = MERGE(
        FOR m IN OUTBOUND u GRAPH 'ratedGraph' // get all movies a user is 
linked to
            OPTIONS {uniqueVertices: 'global', bfs: true} // ignore 
duplicate movies
            FOR g IN m.genre
                LET rating = e.rating
                COLLECT genre = g WITH COUNT INTO count // group by genre
                RETURN {[genre]: count*rating} // return one object per 
genre with key=genre and value=count (merged into single object by MERGE 
function in 2nd line)
    )
    FILTER LENGTH(genreStats) // don't update user documents which are not 
linked to any movie
    UPDATE u WITH {genreStats} IN users // write stats into user document 
as attribute "genreStats"
    RETURN NEW // optionally return updated user document

This does not work because of the grouping. I was trying to include the 
rating in that grouping but this doesn't make sense.

Do have an idea about that?

Thank you! :)

Best, Tobias




-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to