title: How to join array of documents from array of _ids in mongoDB
body: <p>I have a document inside of MongoDb that has an array of ObjectIds. Looks like this:</p>
  <pre><code>--Shops Collection--
  
  listing_ids: [
  ObjectId(&quot;6092f741ccb0d55ba444883e&quot;),
  ObjectId(&quot;6092f741ccb0d55ba444883f&quot;),
  ObjectId(&quot;6092f741ccb0d55ba4448840&quot;),
  ObjectId(&quot;6092f741ccb0d55ba4448841&quot;)
  ],
  ...
  </code></pre>
  <p>and I have a listing document like this:</p>
  <pre><code>--Listings Collection--
  
  _id: ObjectId(&quot;6092f741ccb0d55ba444883e&quot;),
  ...
  </code></pre>
  <p>How do I join the listings documents onto the shops document that contains the arrays? I have tried the &quot;$lookup&quot; operator from MonogoDb but can't get it to work. I'm always hit with a FailedToParse error. This is what the &quot;$lookup&quot; looks like:</p>
  <pre><code>const collection = client.db(&quot;development&quot;).collection(&quot;shops&quot;);
  
      const shop = await collection.aggregate([
        { 
          &quot;$lookup&quot;: {
          &quot;from&quot;: &quot;listings&quot;,
          &quot;localfield&quot;: &quot;listing_ids&quot;,
          &quot;foreignField&quot;: &quot;_id&quot;,
          &quot;as&quot;: &quot;listings&quot;
        }}
      ]).toArray();
  </code></pre>
  <p>This is expected to return all of the shops documents with the corresponding listings documents in an array called <code>listings</code></p>