可能填充两个级别?

说我有如下的collections品/文件:

问题收集:

{ _id: ObjectId("0000"), title: "test question", survey: ObjectId("1234") //abbreviated for question assume this is a legit object id } 

调查收集:

 { _id: ObjectId("1234"), title: "survey title!", user: ObjectId("5678") } 

用户集合:

 { _id: ObjectId("5678"), Name: "Abe" } 

有没有办法给我打电话:

 questions.findOne({_id: "0000"}).populate("survey.user") 

获取用户信息与问题? 我明白,我可以填补question的直接父母,但我很好奇,如果可以为祖父母。

你需要分两步做, 首先填充survey ,然后填充survey.user使用一个单独的调用Model.populate

 questions.findOne({_id: '0000'}) .populate('survey') .exec(function(err, question) { questions.populate( question, { path: 'survey.user', model: 'User'}, function(err, question) {...}); });