Constraints
UNIQUE constraints prevent duplicate property values across all nodes with a given label.
CREATE CONSTRAINT ON (n:Person) ASSERT n.email IS UNIQUEAttempting to create a node with a duplicate value will return a typed error.
Drop a constraint#
DROP CONSTRAINT ON (n:Person) ASSERT n.email IS UNIQUEList constraints#
CALL db.constraints()Causal constraints#
REQUIRE <prop> CAUSED_BY (:<AnchorLabel>) declares that any write to the
named property on a node of the given label must carry a same-transaction
:CAUSED_BY edge to a node of the anchor label.
CREATE CONSTRAINT FOR (n:Player)
REQUIRE confidence CAUSED_BY (:Evidence)Writes that violate the constraint fail at commit with a typed
CAUSED_BY_VIOLATION error and roll back the entire transaction. See
Causal Edges for the full discipline.
See Also#
- Indexes — performance indexes
- Causal Edges — the
:CAUSED_BYdiscipline
Try it
Open ↗⌘↵ to run
Loading engine…