title: How to join with nested array in MongoDB driver for NodeJS?
body: <p>I am using MongoDB shell version v3.6.3.
  I have two collections 1. User 2. Business
  I have given sample data below.</p>
  <pre><code>user
  ********
  _id : 1
  username : &quot;joyjeba2&quot;
  mobile_number : 9840347197,
  profile_url :&quot;http://localhost:3001/user/1599214209351_dp1.jpg&quot;
  saved_products :[1,2]
  
  Business
  *****
  _id:1
  name : &quot;businessname1&quot;
  location :&quot;location&quot;,
  contact_number:123456,
  Products : [
  {   &quot;name&quot;: &quot;product&quot;,
      &quot;tags&quot;: [
          &quot;shoes&quot;,
          &quot;slippers&quot;
      ],
      &quot;description&quot;: &quot;its a simple description&quot;,
      &quot;lower_price&quot;: 20,
      &quot;higher_price&quot;: 30,
      &quot;min_order&quot;: 20,
      &quot;units&quot;: &quot;count&quot;,
      &quot;media_urls&quot;: [
          &quot;http://localhost:3001/product/1586703106075_DP1.jpg&quot;
      ],
      &quot;_id&quot;: 1
  }
  {   &quot;name&quot;: &quot;product&quot;,
      &quot;tags&quot;: [
          &quot;shoes&quot;,
          &quot;slippers&quot;
      ],
      &quot;description&quot;: &quot;its a simple description&quot;,
      &quot;lower_price&quot;: 20,
      &quot;higher_price&quot;: 30,
      &quot;min_order&quot;: 20,
      &quot;units&quot;: &quot;count&quot;,
      &quot;media_urls&quot;: [
          &quot;http://localhost:3001/product/1586703106075_DP1.jpg&quot;
      ],
      &quot;_id&quot;: 2
  },  
  ]
  </code></pre>
  <p>now i want to make a join from <code>saved_products</code> in user collection to products in  business collection.</p>
  <p>Expected result is:</p>
  <pre><code>_id : 1
  username : &quot;joyjeba2&quot;
  mobile_number : 9840347197,
  profile_url :&quot;http://localhost:3001/user/1599214209351_dp1.jpg&quot;
  saved_product : [
  {   &quot;name&quot;: &quot;product&quot;,
      &quot;tags&quot;: [
          &quot;shoes&quot;,
          &quot;slippers&quot;
      ],
      &quot;description&quot;: &quot;its a simple description&quot;,
      &quot;lower_price&quot;: 20,
      &quot;higher_price&quot;: 30,
      &quot;min_order&quot;: 20,
      &quot;units&quot;: &quot;count&quot;,
      &quot;media_urls&quot;: [
          &quot;http://localhost:3001/product/1586703106075_DP1.jpg&quot;
      ],
      &quot;_id&quot;: 1
      &quot;_business_id&quot;:1,   
      &quot;business_name&quot; : &quot;businessname1&quot;
      &quot;location&quot; :&quot;location&quot;
  }
  {   &quot;name&quot;: &quot;product&quot;,
      &quot;tags&quot;: [
          &quot;shoes&quot;,
          &quot;slippers&quot;
      ],
      &quot;description&quot;: &quot;its a simple description&quot;,
      &quot;lower_price&quot;: 20,
      &quot;higher_price&quot;: 30,
      &quot;min_order&quot;: 20,
      &quot;units&quot;: &quot;count&quot;,
      &quot;media_urls&quot;: [
          &quot;http://localhost:3001/product/1586703106075_DP1.jpg&quot;
      ],
      &quot;_id&quot;: 2,
      &quot;_business_id&quot;:1,   
      &quot;business_name&quot; : &quot;businessname1&quot;
      &quot;location&quot; :&quot;location&quot;
  },  
  ],
  </code></pre>
  <p>I am able to do this when product is separate collection (with the help of lookup and unwind). But here product is inside a business collection as a nested document.  How can i achieve this. Please help me out.</p>