apoc.schema.node.constraintExists
Function
apoc.schema.node.constraintExists(labelName String, propertyName [String])
- returns a boolean depending on whether or not a constraint exists for the given node label with the given property names.
Signature
apoc.schema.node.constraintExists(labelName :: STRING?, propertyName :: LIST? OF STRING?) :: (BOOLEAN?)
Usage Examples
The examples in this section are based on a database that has applied the following constraints:
CREATE CONSTRAINT personName FOR (person:Person)
REQUIRE person.name IS UNIQUE;
CREATE CONSTRAINT userId FOR (user:User)
REQUIRE user.id IS UNIQUE;
RETURN apoc.schema.node.constraintExists("Person", ["name"]) AS output;
output |
---|
TRUE |
RETURN apoc.schema.node.constraintExists("Person", ["name", "id"]) AS output;
output |
---|
FALSE |
Was this page helpful?