graph - ArangoDB: Get all links out of an array of nodes -


following after this question , excellent answer codemanx , ask how use previous result (an array of returned nodes) query out of links in collection.

basically intended use result of

for v in 0..100 "entity/node_id"  entityrelation options       {uniquevertices: "global"} return v._key 

for query links:

"for c in entityrelation filter c._from==" + "\"" +  node._id + "\"" + " or c._to==" + "\"" +  node._id + "\"" + " return c"; 

how should approach it?

i'm not sure want achieve exactly, here 2 possible solutions:

for v in 0..100 "entity/node_id" entityrelation options {uniquevertices: "global"}   vv, c in v entityrelation     return c 

above query uses nested for-loop (actually traversal) perform traversal each node returned outer traversal, using v start vertex , ignoring direction of edges. entire edge documents of inner traversal returned.

if want edges of outer traversal, isn't necessary:

for v, e in 0..100 "entity/node_id" entityrelation options {uniquevertices: "global"}   return e 

if want access traversal results later in query, turn subquery , assign result variable:

let nodes = (   v in 0..100 "entity/node_id" entityrelation options {uniquevertices: "global"}     return v._id ) node in nodes   vv, c in node entityrelation     return c 

note first traversal returns document ids. sufficient start traversal these nodes, , no other properties of vertices used in query anyway. returning whole documents work well, not efficient.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -