P
P
Polina Titova2022-04-03 19:03:27
MongoDB
Polina Titova, 2022-04-03 19:03:27

How to fix an error when requesting data?

Request:

query($id: ID) {
  movie(id: $id) {
    id
    name
    director{
      name
    }
  }
}


Answer:
{
  "errors": [
    {
      "message": "Operation `movies.findOne()` buffering timed out after 10000ms",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "movie"
      ]
    }
  ],
  "data": {
    "movie": null
  }
}


The code:
const Query = new GraphQLObjectType({
  name: 'Query',
  fields: {
    movie: {
      type: MovieType,
      args: { id: { type: GraphQLID } },
      resolve(parent, args) {
        return Movies.findById(args.id);
      },
    },
  }
});

The database is connected, the necessary collections and documents in them are created. What's wrong, how to fix it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question