Search code examples
neo4juniqueunique-constraint

How to create unique CONSTRAINT to relationship by neo4j cypher?


How to create unique CONSTRAINT to relationship by neo4j cypher?


Solution

  • At present, there is only one kind of CONSTRAINT neo4j will let you create, and that's a UNIQUENESS constraint. That link cites what's in the internal API, and you'll notice there's only one type at present.

    Here's a link on how to create a uniqueness constraint.

    This lets you assert that a certain property of a node must be unique, but it doesn't say anything about relationships. I don't think it's possible to constrain what sort of relationships can come off of various nodes.