I want to query a collection in ArangoDB using AQL, and at each node in the query, expand the node using a traversal.
I have attempted to do this by calling the traversal as a subquery using a LET statement within the collection query. The result set for the traversal is empty, even though the query completes.
FOR ne IN energy
FILTER ne.identifier == "12345"
LET ne_edges = (
FOR v, e IN 1..1 ANY ne relation
RETURN e
)
RETURN MERGE(ne, {"edges": ne_edges})
[
{
"value": 123.99,
"edges": []
}
]
I have verified there are edges, and the traversal returns correctly when it is not executed as a subquery.
It seems as if the initial query is completing before a result is returned from the subquery, giving the result below.
What am I missing? or is there a better way?
ne.identifier == "12345"
? – Peter Liapinenergy
? Is it a collection? If so, the output you posted should be a bit different. It should also contain some system attributes like_key
and_id
. May be that is a problem. When you do a traversal you must specify and object or an _id value of a starting object. If youne
is not an object which have an_id
attribute the traversal would not work. – Peter Liapin