ArangoDB v3.13 is under development and not released yet. This documentation is not final and potentially incomplete.
Relations
With the annotation @Relations
applied on a collection or array field in a
class annotated with @Document
, the nested objects are fetched from the
database over a graph traversal with your current object as the starting point.
The most relevant parameter is edge
. With edge
you define the edge collection -
which should be used in the traversal - using the class type. With the parameter
depth
you can define the maximal depth for the traversal (default 1) and the
parameter direction
defines whether the traversal should follow outgoing or
incoming edges (default Direction.ANY).
Examples
@Document(value="persons")
public class Person {
@Relations(edge=Relation.class, depth=1, direction=Direction.ANY)
private List<Person> friends;
}
@Edge(name="relations")
public class Relation {
}
Note: Since arangodb-spring-data 3.0.0 the annotation @Relations
also work
on non-collection/non-array fields. If multiple documents are linked with the
entity, it is not guaranteed that the same document is returned every time.
Use at your own risk.