Unique index for a child 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.

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.

1 Like