title: MongoDB: How to populate the nested object with lookup query?
body: <p>I am fetching list of records having some nested reference to other collection, I want to populate that nested ObjectId which is inside array of objects, with mongoDb aggregate lookup query.</p>
  <p>This is how DB collection structure is:</p>
  <pre><code>{
    subject: {type: String},
    body: {type: String},
    recipients: [{
      userId: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
      stutus: {type: String, enum: ['pending','accepted','rejected'], default:'pending'}
    }],
    sender: {type: mongoose.Schema.Types.ObjectId, ref: 'User'}
  }
  </code></pre>
  <p>What I am expecting:</p>
  <pre><code>[{
    subject: 'Some subject here.',
    body: 'Lorem ipsum dolor emit set',
    recipients: [{
      userId: {firstName: 'John', lastName: 'Doe'},
      status: 'accepted'
    },{
      userId: {firstName: 'Jane', lastName: 'Doe'},
      status: 'accepted'
    }],
    sender: {firstName: 'Jacobs', 'lastName': 'Doe'}
  },{
    subject: 'Some subject here.',
    body: 'Lorem ipsum dolor emit set',
    recipients: [{
      userId: {firstName: 'Jane', lastName: 'Doe'},
      status: 'rejected'
    },{
      userId: {firstName: 'John', lastName: 'Doe'},
      status: 'accepted'
    }],
    sender: {firstName: 'Jacobs', 'lastName': 'Doe'}
  }]
  </code></pre>
  <p>Any kind help will be greatly appreciated.</p>