Neo4J gets node by ID

I use neo4j for one of my projects, there is a node that has only one property as name , I want to get this node using ID, it already has an identifier, but when I use this code

MATCH (s:SKILLS{ID:65110}) return s

It returns nothing, heres my node

enter image description here

If the request is incorrect, then how can I request it using the number

+44
neo4j
Mar 13 '14 at 5:07
source share
3 answers
 MATCH (s) WHERE ID(s) = 65110 RETURN s 

The ID function gets the node identifier or relationship. This is different from any property called an ID or ID that you create.

+71
Mar 13 '14 at 5:22
source share

Warning. The following answer is incorrect! START should only be used when accessing legacy indexes . This is disabled in Cypher 2.2 and higher .

Neo4j recommends using WHERE ID(n) = and, in addition, claims that it will only need one search (does not scan each node to find the corresponding identifier)

Keeping this answer so that no one makes a mistake.

You can use WHERE ID(s) = 65110 , but this will check the identifier of each node in your database.

There is a more efficient way to do this:

 START s=NODE(517) MATCH(s) RETURN s 
+5
Feb 26 '16 at 20:26
source share

you can say:

 (n:User) where id(n) >=20 RETURN n 

this will return all nodes of type User with the link identifier node greater than 20

+1
May 20 '15 at 15:18
source share



All Articles