I am using neo4j for one of my project, there\'s a node which only has a single property as name
, I want to get that node using ID, it already has a ID but when
Warning: The following answer is incorrect! START should only be used when accessing legacy indexes. It is disabled in Cypher 2.2 and up.
Neo4j recommends using WHERE ID(n) = , and furthermore states that it will only require a single lookup (does not scan every node to find the matching ID)
Keeping this answer to prevent anyone from making the same mistake.
You can use WHERE ID(s) = 65110
, but this will check the ID of every node in your database.
There is a more efficient way to do this:
START s=NODE(517) MATCH(s) RETURN s
MATCH (s)
WHERE ID(s) = 65110
RETURN s
The ID function gets you the id of a node or relationship. This is different from any property called id
or ID
that you create.
you can say:
(n:User) where id(n) >=20 RETURN n
this will return all nodes of type User with node reference ID more than 20