Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongodb mongoose document populate nested document

   Project.find(query)
    .populate({ 
      path: 'pages',
      populate: [{
       path: 'components',
       model: 'Component'
      },{
        path: 'AnotherRef',
        model: 'AnotherRef',
        select: 'firstname lastname'
      }] 
   })
   .exec(function(err, docs) {});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongodb #mongoose #document #populate #nested #document
ADD COMMENT
Topic
Name
5+7 =