Cypher

unique constraint

A constraint that permits only one node or relationship with a given property value for its label or type.

Example

No two (:Movie) nodes may hold the same movieId.

cypher
CREATE CONSTRAINT Movie_movieId_unique IF NOT EXISTS
FOR (m:Movie) REQUIRE m.movieId IS UNIQUE

A write creating a second (:Movie) with a movieId already in the graph is rejected, and its transaction fails. A (:Movie) carrying no movieId at all is stored, because the constraint compares the values that exist.

Lessons that use this term

The lesson and course links below open in a new tab.

No published lesson uses this term yet.

All glossary terms