join - ArangoDB link documents -
is possible link documents different collections in arangodb in orientdb?
in orientdb can create field of type link
, specify type linked. creates relation between both documents.
do have utilize border collections in arangodb?
i'm trying define main collection , secondary collection info supplement main one. don't want have info in main collection shared between other entities.
thanks in advance.
there 2 options:
using joins
you can define attribute on main document containing info identifies sub-document (e.g. _key
) , utilize aql bring together 2 documents in query:
for x in maindocuments filter x.whatever < 42 y in secondarydocuments filter x.sub = y._key homecoming merge(x,y)
using edges
you can define border collection holding "relations" between documents. border documents can optionally additional info on edges themselves.
for x in maindocuments allow n = neighbors("maindocuments", "edgecollection", x._id, "any"); homecoming merge(x, n[0].vertex);
however there no such thing foreign key constraint in arangodb. can refer non-existing documents in edges or delete sub-document without main document beingness informed.
the benefit of sec approach can utilize arbitrary number of edges between these documents , decide on 0, 1 or more during runtime of application without modification. first approach have decide @ origin making attribute single value or list of values.
join hyperlink document-database arangodb
No comments:
Post a Comment