Second level of nested schema is not populated

128 views
Skip to first unread message

Erwin Poeze

unread,
Aug 29, 2013, 2:37:25 AM8/29/13
to mongoo...@googlegroups.com
Hi,

https://gist.github.com/donnut/6368167 shows an example of a App referening to Panel refering to Master. The idea is to populate App with the contents of Panel and Panel with contents of Master.

Running to following query ...
      App.find().populate({
        path: 'panel'
      }).populate({
        path:'master'
      }).exec(function(err, res) {

              ....

...only populates App with the contents of Panel. Panel is not populated however:
[{"name":"application","_id":"521eea62594fd70e1b000003","__v":0,"panel":[{"name":"paneel","_id":"521eea62594fd70e1b000002","__v":0,"master":["521eea62594fd70e1b000001"]}]}]

Can you please assist?
Thanks,
Erwin

Erwin Poeze

unread,
Aug 29, 2013, 3:47:10 AM8/29/13
to mongoo...@googlegroups.com
In post https://groups.google.com/forum/#!topic/mongoose-orm/yuKEqiu4JHI Aron states:

Populating references spanning more than two collections must be done manually using Model.populate(docs, options, callback).

I tried that, see second file in the gist, but the result is the same, so no population of the second level collection.
 

Op donderdag 29 augustus 2013 08:37:25 UTC+2 schreef Erwin Poeze:

Erwin Poeze

unread,
Aug 29, 2013, 10:03:00 AM8/29/13
to mongoo...@googlegroups.com
Issues https://github.com/LearnBoost/mongoose/issues/601 states "The latest Mongoose release does support deep population, but only within one schema." That's probably the answer for now.
Reply all
Reply to author
Forward
0 new messages