2
votes

Using ArangoDB, how can I set different search directions for the edge collections in an AQL query? For example in this query, I'd like the 'trusts' edge direction to be restricted to outbound whilst the 'likes' edge direction can be any. From the documentation it looks like I can only set a global direction but I just want to make sure I didn't miss something.

FOR p IN GRAPH_SHORTEST_PATH('myGraph', 'users/PeterB', 'marks/Moon',
 {edgeCollectionRestriction : ['trusts', 'likes']})
2

2 Answers

1
votes

Directly you can not (yet) set a direction for each collection in a simple way, so you are not missing anything in the documentation.

I have this feature on my "to implement" list though.

0
votes

In ArangoDB v3, you can specify the direction (or directions) to traverse in an AQL query using one of OUTBOUND, INBOUND, or ANY. The basic syntax is:

FOR v,e,p IN @MN .. @MX @DIRECTION @start @edges

but if your query has multiple Edge collections, you can specify the directions on a per—Edge-collection basis. See the AQL documentation for details, e.g. https://docs.arangodb.com/3.2/AQL/Graphs/Traversals.html