Every node in my DB has a property that holds a list. I need to check whether any item in a given list is in that property.
I'm looking for a query like match (n) where any(x in n.list where x=[101,102,103]) return n
- which means "check if n.list contains 101, 102, 103. If so, return n"
Is there anything like that in cypher?
You pretty much have the answer to your question !
Check this : https://neo4j.com/docs/cypher-manual/current/functions/predicate/#functions-any, the any predicate exists.
The only error in your query is x=[101,102,103]
that you should change by x IN [101,102,103]
So the final query is :
MATCH (n)
WHERE any(x IN n.list WHERE x IN [101,102,103])
RETURN n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With