Posts

Showing posts from September 18, 2018

Find Child's of Child document in Mongoose Node JS

Image
This Article is basically to populate records/data/documents of child table and also for populate records/data/documents from Child's of child table in mongoose(Mongo DB). Suppose, you have three tables 1) Subjects 2) Chapters 3) Questions Questions schema is having the reference of Chapters (_id) and Chapters is having reference of Subjects (_id). So this is the Many to One relationship between them.  If developer wants to populate Chapter name and Subject name with the Questions. Then you have to write find query like below: Questions.find({})   .populate({       path: 'Chapters',      populate: {        path: 'Subjects',        model: 'Subjects'      }    }) Thanks for reading this article. Please share your comments on this article.

Recent Post

Recent Posts Widget