apoc.schema.relationship.constraintExists

Function

apoc.schema.relationship.constraintExists(type STRING, propertyName LIST<STRING>) - returns a BOOLEAN depending on whether or not a constraint exists for the given RELATIONSHIP type with the given property names.

This function is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13). For more information, see the Cypher Manual → Parallel runtime.

Signature

apoc.schema.relationship.constraintExists(type :: STRING, propertyName :: LIST<STRING>) :: BOOLEAN

Input parameters

Name Type Default

type

STRING

null

propertyName

LIST<STRING>

null

Usage Examples

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

CREATE CONSTRAINT likesDay
FOR ()-[like:LIKED]-()
REQUIRE (like.day) IS NOT NULL;
RETURN apoc.schema.relationship.constraintExists("LIKED", ["day"]) AS output;
Table 1. Results
output

TRUE