cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Unique Constraint on Relationship Types

Neo4j Version: Neo4j Enterprise 4.3.5
API : Neo4j Java Driver

Neo4j does not support Unique property constraints on relationships; however, I need to enforce uniqueness for a property within a Relationship Type. What is the best way to achieve that?

1 REPLY 1

The best thing is to put up a feature request on github.

For now on relationships there are only existence constraints and indexes.

So you would have to do it manually, by using MERGE on a relationship, and possibly taking a lock on a central node for concurrency safety.

MERGE (start)-[:TYPE {id:$relId}]->(end)