Is it possible to add unique constraints to node properties? I have a property called "id" which is a string and I need to guarantee that it's unique. What's the best approach to this?
Note: we want to assign our own rather than use the system IDs.
Thanks.
You sure can. Read the about constraints in the following link.
with examples:
In your case, assume you node with property 'id' is a Person node, then the command would be the following:
CREATE CONSTRAINT PERSON_ID_UNIQUENESS IF NOT EXISTS FOR (n:Person) REQUIRE n.id IS UNIQUE
Thank you. On a side note, can you please tell me why my post was hidden when I replied to your response?
Akismet has temporarily hidden your post - Neo4j Online Community
It was quite a while ago and i'm trying to get answers on this.
Sorry, I am not familiar with that user name, nor can I even find it. Unfortunately I can not shed any light on the issue.