How to disable auto-increment identifier (id) in Neo4j?

Asked

Viewed 78 times

-1

I’m working recently with a nonrelational bank, I’m using Neo4j. When generating the nodes (nodes) with the attributes of the relational database, Neo4j does not allow, because there is an auto increment of the ID, but I need the attribute ID of the relational database to be included, because I will make the relations based on this information.

1 answer

0

Unable to disable auto-increment node ID in Neo4j. In fact, the Ids generated automatically by Neo4j are of internal use of the database. These Ids are even reused by the database when a node or relationship is deleted, as you can see at this link. This way, we cannot "trust" or depend on this ID.

Nothing prevents you from creating your own ID property and using this ID to do your queries / updates from us. For example, when running CREATE (:User {id:1}) you are creating a node with a label :User and a property id igual to 1. This ID has nothing to do with the internal ID managed by Neo4j, so much so that to access it in a WHERE just do WHERE node.id = 1, while to use the internal Neo4j ID you would need to use the function ID (WHERE ID(node) = 1).

  • Thank you very much, helped a lot, I did the recommended one, I created an attribute that references the ID of the relational bank, and this working.

  • Cool, @Andresoares! Please, if this answer has solved your problem remember accept it to inform other users that your issue has been resolved and help future viewers of your issue. Thank you! :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.