Neo4jGraphQL
constructor
Returns a Neo4jGraphQL
instance.
Takes an input
object as a parameter, the supported fields of which are described below.
Input
Accepts all of the options from makeExecutableSchema
, plus the additional arguments below:
Name and Type | Description |
---|---|
|
An instance of a Neo4j driver. |
|
Additional Neo4j GraphQL configuration options. |
|
Plugins for the Neo4j GraphQL Library. |
Neo4jGraphQLConfig
Name and Type | Description |
---|---|
|
Additional driver configuration options. |
|
Whether to enable RegEx filters, see RegEx matching for more information. |
|
Cypher query options, see Query Tuning for more information. |
|
Can be used to disable strict type definition validation if you are encountering unexpected errors. |
DriverConfig
Name and Type | Description |
---|---|
|
The name of the database within the DBMS to connect to. |
|
One or more bookmarks to use for the connection. |
CypherQueryOptions
All options are enum types imported from @neo4j/graphql
, for example:
const { CypherRuntime } = require("@neo4j/graphql");
Name and Type | Description |
---|---|
|
Possible options: |
|
Possible options: |
|
Possible options: |
|
Possible options: |
|
Possible options: |
|
Possible options: |
|
Possible options: |
|
Possible options: |
getSchema
An asynchronous method that generates the GraphQL schema to be used in a server. The result is memoized, so if this is called twice, the schema is only generated once.
checkNeo4jCompat
Asynchronous method to check the compatibility of the specified DBMS, that either resolves to void
in a successful scenario, or throws an error if the database is not compatible with the Neo4j GraphQL Library.
Takes an input
object as a parameter, the supported fields of which are described below.
Example
Given any valid type definitions saved to the variable typeDefs
and a valid driver instance saved to the variable driver
, the following will confirm database compatibility:
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
await neoSchema.checkNeo4jCompat();
Input
Accepts the arguments below:
Name and Type | Description |
---|---|
|
An instance of a Neo4j driver. |
|
Additional driver configuration options. |
assertIndexesAndConstraints
Asynchronous method to assert the existence of database constraints, that either resolves to void
in a successful scenario, or throws an error if the necessary constraints do not exist following its execution.
Takes an input
object as a parameter, the supported fields of which are described below.
Example
Given the following type definitions saved to the variable typeDefs
and a valid driver instance saved to the variable driver
:
type Book {
isbn: String! @unique
}
And the construction of a Neo4jGraphQL
, using:
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
const schema = await neoSchema.getSchema();
The following will check whether a unique node property constraint exists for label "Book" and property "isbn", and throw an error if it does not:
await neoSchema.assertIndexesAndConstraints();
The next example will create the constraint if it does not exist:
await neoSchema.assertIndexesAndConstraints({ options: { create: true } });
Input
Accepts the arguments below:
Name and Type | Description |
---|---|
|
An instance of a Neo4j driver. |
|
Additional driver configuration options. |
|
Options for the execution of |
Was this page helpful?