Search code examples
orientdbnosql

How do I find references to a given record for a specific field in the referencing record in OrientDB?


If I have a class A with attributes A.a and A.b, which are both LINKs that can reference other records of class A, how do I - for a given instance of A - find all the other records that reference this instance in their attribute A.a but not A.b?

Here I just found how to find all referencing records, not distinguishing by which field is used to reference a given record.

Example for clarification: Let's say there's a class Person with attributes personalTrainer and partner, which are other Persons. For a given Person, how do I find all other Persons (hopefully 0 or 1) which have this one as their partner, but not their personalTrainer?


Solution

  • I suggest you to use GraphAPI where all links are automatically managed by OrientDB and you can always cross your relationships in both directions.