title: How to combine 2 arrays based on condition in mongoDb
body: <p>I have an orders collection in which there is items field which is <code>[ { itemId: ObjectId, quantity: number } ]</code></p>
  
  <p>I want to populate itemId with the respective document using aggregation but lookup stage makes a separate array</p>
  
  <p>Desired result: <code>[ { itemId: {} , quantity: number } ]</code></p>
  
  <p>Tried: 
  <a href="https://i.stack.imgur.com/qleWb.png" rel="nofollow noreferrer">Aggregation pic</a></p>
  
  <p>Is there a way to combine these array as such i get the desired result or is there any other way? </p>