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?

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)