Reputation: 1729
I have two Neo4j databases. One is the old version and the other one is the new version. I would like to see which nodes are added to the new version.
For each node in the new version, I try to look if it exists in the old version.
How can I compare if it really is the same node on the other database? Is there a unique identifier in Neo4j nodes that I can use? In relational databases for instance, a row from a table has an ID.
Upvotes: 1
Views: 1638
Reputation: 67044
If your data model had included an explicit unique ID property in every node, then it would be trivial to detect new nodes -- even if a node had property or relationship changes.
Upvotes: 2
Reputation: 9369
If you want to compare two things, you have to compare the two things based on your criteria for equality. If you change the data in a row of a relational database, comparison of the primary key does not guarantee equality. To make sure that two rows are the same, you have to check if the content of the row is the same (or if some other criterion for equality is true).
Nodes in neo4j do not have a unique identifier. They have an internal ID which is reused and should not be used to compare nodes. To make sure that every node from the old database is in the new one, you have to compare them one by one.
Upvotes: 4