简体   繁体   中英

How do I retrieve the nodes deleted after a cypher query?

So I'm deleting some nodes from a database, and I want to retrieve the nodes I've deleted so far so that I don't go looking for them later.

How do I get neo4j ids of the deleted nodes in java code?

You can return the ids of the nodes as you're deleting them:

MATCH (n:SomeLabel)
DELETE n
RETURN id(n)

However, as mentioned in the documentation, ids can be reused by Neo4j, so it's generally a bad idea to keep referencing them outside of a transaction (not sure if that's your use case).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM