neo4j

Get node using id Cypher query neo4j

You can use the below Cypher query to get node using id from neo4j graph database.

MATCH (a)
WHERE ID(a) = 9 // Pass your node id in place of 9
RETURN a

In the above Cypher query, we are getting a node that has id 9. You can pass your node id in place of value 9. Every node in the neo4j graph DB every node has a unique id and you can access it using that id. We are using MATCH and WHERE statements to get that and returning the records.

The above query will check every node for the given id and return it when found. It will return blank record if no node found with the same id.

MATCH(n:Movie) 
where id(n) = 9 
RETURN n
If you want to get the node that is inside another node and you know the node name then you can use the above query which will return the node inside Movie node and has id 9
Was this helpful?