apoc.schema.node.constraintExists

Function APOC Core

RETURN apoc.schema.node.constraintExists(labelName, propertyNames)

Signature

apoc.schema.node.constraintExists(labelName :: STRING?, propertyName :: LIST? OF STRING?) :: (BOOLEAN?)

Input parameters

Name Type Default

labelName

STRING?

null

propertyName

LIST? OF STRING?

null

Usage Examples

The examples in this section are based on a database that has applied the following constraints:

CREATE CONSTRAINT personName ON (person:Person)
ASSERT person.name IS UNIQUE;

CREATE CONSTRAINT userId ON (user:User)
ASSERT user.id IS UNIQUE;
RETURN apoc.schema.node.constraintExists("Person", ["name"]) AS output;
Table 1. Results
output

TRUE

RETURN apoc.schema.node.constraintExists("Person", ["name", "id"]) AS output;
Table 2. Results
output

FALSE