How to get node's id with cypher request?

Aleksandrenko picture Aleksandrenko · Oct 5, 2014 · Viewed 17.3k times · Source

I'm using neo4j and making executing this query:

MATCH (n:Person) RETURN n.name LIMIT 5

I'm getting the names but i need the ids too. Please help!

Answer

subvertallchris picture subvertallchris · Oct 5, 2014

Since ID isn't a property, it's returned using the ID function.

MATCH (n:Person) RETURN ID(n) LIMIT 5