OrientDB query for nodes connected to origin by multiple ways

86 views Asked by At

For example, I have employee managing particular country and particular company. I want to query only accounts which are in countries AND companies managed by the given employee. Ideas? Performance issues to be aware of?

Gremlin query is acceptable, also!

1

There are 1 answers

0
5ar On BEST ANSWER

This seems to work:

select from Account where 
@rId in 
(select expand(out('managingCountry').in('inCountry')).@rId
from Employee where userId = 3) 
AND 
@rId in 
(select expand(out('managingCompany').in('inCompany')).@rId
from Employee where userId = 3) 

Remains if someone has the better solution