I am working with Graphql and then I come to a situation where I need to populate, but I am not getting how to excute that.
Here is my Booking schema
I have never made anything like this before but after saving new Booking
here:
const result = await booking.save();
You can use .populate() on result
. Example:
await result.populate("user");
Or if the above not work:
await result.populate("user").execPopulate();
I hope it may help you.
const result = await booking.save();
const res=await booking.findById(result._id).populate("user");
console.log(res)