mirror of https://gitee.com/bigwinds/arangodb
18 lines
389 B
Plaintext
18 lines
389 B
Plaintext
FOR u IN users
|
|
LET recommendations = (
|
|
FOR r IN recommendations
|
|
FILTER u.id == r.userId
|
|
SORT u.rank DESC
|
|
LIMIT 10
|
|
RETURN r
|
|
)
|
|
RETURN { "user" : u, "recommendations" : recommendations }
|
|
|
|
|
|
FOR u IN users
|
|
COLLECT city = u.city INTO g
|
|
RETURN { "city" : city, "numUsers" : LENGTH(g), "maxRating": MAX(
|
|
FOR r IN g
|
|
RETURN r.user.rating
|
|
) }
|