Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-28-2020 11:59 AM
Hello all,
I am struggling to prevent the following problem. My understanding was the the Neo4j DB automatically created unique IDs for all objects. However I have managed to create data where the same ID is shared by an unrelated Node and Relationship. See the following image:
Is this behavior expected? Thank you, I've likely done something very basic wrong as I am new.
Solved! Go to Solution.
12-28-2020 02:15 PM
Hi marlo,
one of the id is from node and other from a relationship. As @dana.canzano mentioned ->
Neo4j reuses its internal ids when nodes and relationships are deleted. This means
that applications using, and relying on internal Neo4j ids, are brittle or at risk of
making mistakes. It is therefore recommended to rather use application-generated
ids.
So this is the reason, I started to used UUID. The advantage of UUID's are its is unique across the entire database.
12-28-2020 01:10 PM
ids are unique by object type. i.e. one can create a node which has an internal id of X and also create a relationship which also has an internal id of X. This is expected and allowed.
Also per MATCH - Neo4j Cypher Manual
Neo4j reuses its internal ids when nodes and relationships are deleted. This means
that applications using, and relying on internal Neo4j ids, are brittle or at risk of
making mistakes. It is therefore recommended to rather use application-generated
ids.
12-28-2020 02:15 PM
Hi marlo,
one of the id is from node and other from a relationship. As @dana.canzano mentioned ->
Neo4j reuses its internal ids when nodes and relationships are deleted. This means
that applications using, and relying on internal Neo4j ids, are brittle or at risk of
making mistakes. It is therefore recommended to rather use application-generated
ids.
So this is the reason, I started to used UUID. The advantage of UUID's are its is unique across the entire database.
12-28-2020 02:25 PM
Thank you @dominicvivek06 . I didn't realize about Neo4j reusing ids. I will move over to uuids. All the best.
All the sessions of the conference are now available online