Populating the “Ref” in mongoose schema while working with Graphql

前端 未结 2 424
刺人心
刺人心 2021-01-15 00:21

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

         


        
2条回答
  •  遥遥无期
    2021-01-15 00:51

    I hope it may help you.

    const result = await booking.save();
    const res=await booking.findById(result._id).populate("user");
    console.log(res)
    

提交回复
热议问题