问题
Using Cypher, how can I find a node where a property doesn't exist?
For example, I have two nodes:
A = {foo: true, name: 'A'}, B = { name: 'B'}
Now I'd like to find B, selecting it on the basis of not having the foo
property set. How can I do this?
回答1:
As Michael Hunger mentioned
MATCH (n) WHERE NOT EXISTS(n.foo) RETURN n
On older versions of Neo4j you can use HAS:
# Causes error with later versions of Neo4j
MATCH (n) WHERE NOT HAS(n.foo) RETURN n
回答2:
MATCH (f) WHERE f.foo IS NULL RETURN f
来源:https://stackoverflow.com/questions/35400674/find-neo4j-nodes-where-the-property-is-not-set