Answers for "mongodb mongoose document populate nested document"

1

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) {});
Posted by: Guest on March-19-2021

Browse Popular Code Answers by Language