How to get node's id with cypher request?

后端 未结 3 2160
时光取名叫无心
时光取名叫无心 2021-02-18 14:13

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

3条回答
  •  野性不改
    2021-02-18 14:29

    Not sure how helpful or relevant this is, but when I'm using the NodeJS API the record objects returned from Cypher queries have an identity field on the same level as the properties object (e.g record.get(0).properties, record.get(0).identity). I'm assuming you aren't just doing plain Cypher queries and actually using a driver to send the queries - so you might not have to run another MATCH statement.

    I'm aware that the OP is asking about Cypher specifically - but it might be helpful to other users that stumble upon this question.

提交回复
热议问题