apoc.schema.relationship.constraintExists

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

  • Prior to the release of APOC 2025.07, this function was restricted on on-premise instances. To use it on an older version, it must be unrestricted. For more details, see Installation → Load and unrestrict.

Details

Syntax

apoc.schema.relationship.constraintExists(type, propertyName)

Description

Returns a BOOLEAN depending on whether or not a constraint exists for the given RELATIONSHIP type with the given property names.

Arguments

Name

Type

Description

type

STRING

The relationship type to check for a constraint on.

propertyName

LIST<STRING>

The property names to check for a constraint on.

Returns

BOOLEAN

Prior to the release of APOC 2025.07, this procedure was restricted on on-premise instances. To use it on an older version, it must be unrestricted. For more details, see Installation → Load and unrestrict.

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;
Results
output

TRUE