Answer the question
In order to leave comments, you need to log in
Why does Graphql return undefined if everything in console.log has data?
Good afternoon, there is a Resolver in which there is a Query. It is required to search for a restaurant by id
and if, for example, we insert such a code, everything works fine
Restaurant: async(parent, args) => {
return await Restaurant.findOne({_id: args.id})
}
Restaurant: async(parent, args) => {
const items = await Restaurant.findOne({_id: args.id})
const populatedItems = await items.populate('kinds').execPopulate()
return populatedItems
}
Answer the question
In order to leave comments, you need to log in
I found an error, the fact is that in Type I determined that I only get ID and therefore when I received the kinds object instead of id there was an error. It was necessary to fix in Type and query
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question