3
votes

Is it possible to query, through the same AQL query, several collections effectivelly (with index speed) being some of those edge or document collections? I wanted to emulate more or less the behaviour of foreign keys on RDBMs on tables using edges.

Thanx

2

2 Answers

5
votes

I can confirm: EDGES() and NEIGHBORS() will use the automatically available indexes on the _from and/or _to attributes in the edge collections.

You may also join manually using a FILTER clause, e.g.

FOR ...
  FILTER e._from == something_else._id
  RETURN ...
4
votes

If you are using document fields which are indexed by default then the behaviour is similar to foreign keys in RDBMS. For example, by default, document type collections indexes _id field and edge type collections indexes _id, _from and _to fields. AQL functions such as EDGES or NEIGHBORS are using these indexes to query relevant data.