cancel
Showing results for 
Search instead for 
Did you mean: 

Unique index for a child node

rajan1106
Node

I have this relationship
Node1 ---- HAS ----> Node2

I want to make sure that the "name" property in Node2 is unique within it's parent node - Node1.

Is it possible to enforce that using Neo4J-OGM?
Or do I have to make a separate get call before calling save?

Thank you.

1 ACCEPTED SOLUTION

gerrit_meier
Neo4j
Neo4j

No, this is not possible within Neo4j-OGM. But it is also not possible to do this in Neo4j.
You would have to enforce the rule by calling a query upfront the persistence to know about the potential existence of another node with the same name in the sub-group.

View solution in original post

1 REPLY 1

gerrit_meier
Neo4j
Neo4j

No, this is not possible within Neo4j-OGM. But it is also not possible to do this in Neo4j.
You would have to enforce the rule by calling a query upfront the persistence to know about the potential existence of another node with the same name in the sub-group.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.