简体   繁体   中英

How can I find a node of a particular type in Neo4j Cypher?

I want to find a node which has a property type = user in Neo4j, but not all of my nodes have the type property. When I do this:

START root=node(*) where root.type="user" RETURN root  

I get the error:

Cypher error

The property 'type' does not exist on Node[0]

: how can I get this to work, or am I misunderstanding something fundamental with Neo4j?

You need to use has() function. The Node (Node[0]) with id 0 is called the reference node in Neo4j which is used by Neo4j internally.

START root=node(*) where has(root.type) AND root.type="user" RETURN root 

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM