title: $lookup using mongoose
body: <p>I have two collections like checklists and tasks. Two schemas will look like below</p>
  <p>checklist schema will look like beow</p>
  <pre><code>{
    &quot;_id&quot;: &quot;5b7d0f77e231b6b530b0ee5a&quot;,
    &quot;audit_checklist_type&quot;: &quot;Weekly&quot;
  
  }, {
    &quot;_id&quot;: &quot;5b7d3f33e7a57f38084efb09&quot;,
    &quot;audit_checklist_type&quot;: &quot;Daily&quot;
  }
  </code></pre>
  <p>Tasks Schema will look like below</p>
  <pre><code>{
    &quot;_id&quot;: &quot;5b7d65daf74be318e8378cf9&quot;,
    &quot;checklist_id&quot;: &quot;5b7d3f33e7a57f38084efb09&quot;
  }, {
    &quot;_id&quot;: &quot;5b7d662df74be318e8378cfb&quot;,
    &quot;checklist_id&quot;: &quot;5b7d3f33e7a57f38084efb09&quot;
  }
  </code></pre>
  <p>my query is</p>
  <pre><code>AuditChecklist.aggregate([
    {
      $match: {
        $and: [
          audit_checklist_type: &quot;Daily&quot;
        ]
      },
    },
    {
      $lookup: {
        from: 'AuditTask',
        localField: '_id',
        foreignField: 'checklist_id',
        as: 'TaskData',
      },
    },
  ]).exec()
  </code></pre>
  <p>I'm trying to get the output like</p>
  <pre><code>{
    &quot;_id&quot;: &quot;5b7d3f33e7a57f38084efb09&quot;,
    &quot;TaskData &quot;: [{
        &quot;_id&quot;: &quot;5b7d65daf74be318e8378cf9&quot;,
        &quot;checklist_id&quot;: &quot;5b7d3f33e7a57f38084efb09&quot;
      },
      {
        &quot;_id&quot;: &quot;5b7d662df74be318e8378cfb&quot;,
        &quot;checklist_id&quot;: &quot;5b7d3f33e7a57f38084efb09&quot;
      }
    ]
  }
  </code></pre>
  <p>But for me resulting TaskData output is empty.
  Any help is greatly appreciated. Thanks in advance!</p>