Get populated data from Mongoose to the client Get populated data from Mongoose to the client mongoose mongoose

Get populated data from Mongoose to the client


you are using this feature in the wrong way you should defined a Object in your resolvers with your model name and that object should contain a method that send the realated user by the parant value.

here is a full document from apollo server docs for how to use this feature


use lean() like this :

 const posts = await Post.find().populate("user").lean();