Say I have collections/documents like below:
question collection:
{
_id: ObjectId(\"0000\"),
title: \"test question\",
survey: ObjectId(\"1234\"
I guess the best is to nest in the top populate and make it as a object
Court.
findOne({ name: 'Val' }).
populate({
path: 'events',
populate: { path: 'authorId' }
});
http://mongoosejs.com/docs/populate.html#deep-populate
You need to do it in two steps; first populating survey
, and then populating survey.user
using a separate call to Model.populate:
questions.findOne({_id: '0000'})
.populate('survey')
.exec(function(err, question) {
questions.populate(
question,
{ path: 'survey.user', model: 'User'},
function(err, question) {...});
});