Global configuration

Through the schema configuration, it is possible to globally disable specific types of operation. To set up operations individually, refer to Type Configuration.

For instance, if you want to disable all top-level aggregation operations at once, the Neo4j GraphQL Library offers this option through schema extensions with @query:

type Movie {
    title: String
    actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
}

type Actor {
    name: String
    movies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT)
}
extend schema @query(read: true, aggregate: false)

Query

  • movies

  • moviesAggregate

  • moviesConnection

  • actors

  • actorsAggregate

  • actorsConnection

Invalid schema usage

The same schema configuration directive cannot be applied to both Schema and Object. Take the following type definitions as example:

type Movie {
    title: String
    actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
}

type Actor @query(read: false, aggregate: true) {
    name: String
    movies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT)
}
extend schema @query(read: true, aggregate: false)

Such configuration prompts the error "@query directive already defined at the schema location".