router.get('/', (req, res) => {
Post.find()
.populate("author")
.populate("comments")
.populate("commentedBy")
.sort({date : -1})
.exec()
.then(posts => res.json(posts));
});
here i am populating the comments from the comment model and then populating the 'commentedBy' from the comment model. The last populating is not working. I am getting {commentedBy: Null, ...}
.populate({ path: "comments", populate: { path: "commentedBy" }})