neo4jAssertConstraints
Uses the APOC extension to keep Neo4j property constraints in sync with @unique fields.
In order to support the use of a @unique
field directive, neo4jAssertConstraints
can be used to send a Cypher query to your Neo4j instance that executes the apoc.schema.assert
procedure. For each type with a @model
directive, constraints are created and kept for any fields on that type with a @unique
directive, in addition to all generated id
fields.
API Reference
typeDefs
(required): Your GraphQL type definitions in SDL format.driver
(required): Your Neo4j driver instance (More info here).log
(default:false
): Logs result from operation.
Example
The following would result in the creation of an index and constraint on the name
property of Technology
nodes in your Neo4j instance.
Resources
APOC: An Introduction to User-Defined Procedures and APOC https://neo4j.com/blog/intro-user-defined-procedures-apoc/
Last updated