Skip to content

ast field in resolve method is undefined in new version (0.7.0) #473

@shayank66

Description

@shayank66

my code is work fine in 0.4.x.
but does not work in 0.7.0

this is my code:

const Query = new GraphQLObjectType({
    name: "Queries",
    fields: {
        authors: {
            type: new GraphQLList(Author),
            resolve: function (rootValue, args, info) {
                let fields = {};
                let fieldASTs = info.fieldASTs;
                fieldASTs[0].selectionSet.selections.map(function (selection) {
                    fields[selection.name.value] = 1;
                });
                return authorsCollection.find({}, fields).toArray();
            }
        }
    }
});

i guess the problem goes from this commit:
separateOperations - a utility function for splitting an AST (#456)

thanks for any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions