'Find Neo4j nodes where the property is not set
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?
Solution 1:[1]
MATCH (f) WHERE f.foo IS NULL RETURN f
Solution 2:[2]
As of version 4.3 EXISTS has been deprecated on properties and instead, you should use IS NOT NULL.
So for the example in your question your query would now be:
MATCH (n) WHERE n.foo IS NULL RETURN n
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Andrei R |
| Solution 2 | Dan Christos |
