Wednesday, 21 July 2021

Neo4j: Match a node by id

Below statement is used to return a node that matches to given id.

MATCH (n) WHERE id(n) = {NODE_ID} RETURN n

 

Follow below steps to confirm the same.

 

Step 1: Open neo4j browser by hitting following url in browser.

http://localhost:7474/browser/

Step 2: Execute following query in $ prompt to create a node.

CREATE (RamaKrishna:Person{name: "Rama Krishna", age: 32, city: "Bangalore", male: true}) RETURN RamaKrishna


Step 3: As you see above image, node is assigned with id 4. Execute following statement to get the node with id 4.

 

MATCH (n) WHERE id(n) = 4 RETURN n

 


Previous                                                    Next                                                    Home

No comments:

Post a Comment