title: MongoDB: How to find _id $in array of objects?
body: <p>I have a "group" collection which groups documents from another "item" collection. The <code>group</code> collection is simply an array of ObjectId's from the <code>item</code> collection, however I want to make the objects in the <code>group</code> array more complex and still be able to use the <code>$in</code> and <code>$nin</code> operators.</p>
  
  <p>How can I use <code>$in</code> when changing the value used with the <code>$in</code> operator to an object instead of only an ObjectId?</p>
  
  <pre><code>// current group document
  {
    _id: ObjectId(...),
    items: [
      ObjectId(...),
      ObjectId(...)
    ]
  }
  // current item find query
  db.item.find({ _id : { $in: group.items } }
  </code></pre>
  
  <p>I would like to change the <code>group</code> document to look like the following</p>
  
  <pre><code>{
    _id: ObjectId(...),
    items: [
       { _id : ObjectId(...), name: '...' },
       { _id : ObjectId(...), name: '...' }
    ]
  }
  </code></pre>