PeterB
PeterB

Reputation: 23

ArangoDB edge collection direction

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']})

Upvotes: 2

Views: 434

Answers (2)

peak
peak

Reputation: 116740

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.11/aql/graphs/traversals/

Upvotes: 0

mchacki
mchacki

Reputation: 3267

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.

Upvotes: 1

Related Questions