I have a neo4j database with some data in it. Most of the nodes have a name
property, but not all of them; I'd like to construct a Cypher query to match and return all those that don't.
I've tried all the following, but all of them give 0 results:
MATCH (n { name: NULL }) RETURN n
MATCH (n { name: null }) RETURN n
MATCH (n) WHERE n.name = NULL RETURN n
MATCH (n) WHERE n.name = null RETURN n
However, I have at least one node with no name
property specified, which I can prove either through
MATCH (n) WHERE id(n) = 4 RETURN n
and examining the node in the results view, or by noting that
MATCH (n) WHERE id(n) = 4 RETURN n.name
returns null
.
How do I match all the nodes that don't have a name
property?
有HAS
功能:
MATCH (n) WHERE not has(n.name) RETURN n
EXISTS()
has replaced HAS()
so your query would now look like:
MATCH (n) WHERE NOT EXISTS(n.name) RETURN n
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.