I'm not an OrientDB profi, so maybe my question will sound dumb; but I didn't find any answers in docs or on the Net.
This is a sample of a data structure that I have:
I want to find all of the beavers, that have blue eyes, and they're happy and they know it.
I do manage to select the eye color and the happiness state with out() function - something like
SELECT out('has').eyeColors, out('is').happinessState FROM beavers
SELECT * FROM beavers WHERE out('has').eyeColors = 'blue' AND out('is').happinessState = 'happy and knows it'
SELECT * FROM beavers WHERE (SELECT out('has').eyeColors FROM beavers) = 'blue' AND (SELECT out('is').happinessState FROM beavers) = 'happy and knows it'
in the WHERE condition you need to use the
CONTAINS word because the
out() - so for
both() - returns a list.
select from Beaver where out('has').eyeColors contains "Blue" and out("iss").happinessState contains "happy and knows it"
You can verify whether it returns a list or not by selecting it:
select out('has').eyeColors from Beaver
I see that you're using an edge class called
is that, I think, it's not allowed since it is a private word.
Hope it helps. Ivan
select name from Children let $a=(select from Beaver where in('has').@rid contains $parent.$current.@rid and out('has').eyeColor contains "Blue" and out("iss").happinessState contains "happy and knows it") where $a.size() > 0