Custom Resolvers

The library will autogenerate Query and Mutation resolvers, so you don’t need to implement those resolvers yourself. However, if you would like additional behaviours besides the autogenerated CRUD operations, you can specify custom resolvers for these scenarios.

A note on custom resolvers

Due to the nature of the Cypher generation in this library, you must query any fields used in a custom resolver. For example, in the first example below calculating fullName, firstName and lastName must be included in the selection set when querying fullName. Without this being the case, firstName and lastName will be undefined in the custom resolver.

Custom object type field resolver

If you would like to add a field to an object type which is resolved from existing values in the type, rather than storing new values, you should mark it with an @ignore directive and define a custom resolver for it.

const typeDefs = `
    type User {
        firstName: String!
        lastName: String!
        fullName: String! @ignore

const resolvers = {
    User: {
        fullName(source) {
            return `${source.firstName} ${source.lastName}`;

const neoSchema = new Neo4jGraphQL({

Custom Query/Mutation type field resolver

You can define additional custom Query and Mutation fields in your type definitions and provide custom resolvers for them. A prime use case for this is using the OGM to manipulate types and fields which are not available through the API. You can find an example of it being used in this capacity in the Custom Resolvers example.