title: mongodb: return an array of document ids
body: <p>Is it possible to query mongodb to return array of matching document id values, without the related keys?</p>
  
  <p>Please consider following 'parent' data structur:</p>
  
  <pre><code>{
    "_id": ObjectId("52448e4697fb2b775cb5c3a7"),
    "name": "Peter",
    "children": [
      {
        "name": "joe"
      }
    ]
  },
  {
    "_id": ObjectId("52448e4697fb2b775cb5c3b6"),
    "name": "Marry",
    "children": [
      {
        "name": "joe"
      }
    ]
  }
  </code></pre>
  
  <p>I would to query for an array of parent _ids whose children have the name "joe"</p>
  
  <p>For provided sample data, I would like the following output returned from mongo:</p>
  
  <pre><code>[ObjectId("52448e4697fb2b775cb5c3a7"), ObjectId("52448e4697fb2b775cb5c3b6")]
  </code></pre>
  
  <p>I know that I can query for an output like this, which also contains the keys</p>
  
  <pre><code>[{"_id": ObjectId("52448e4697fb2b775cb5c3a7")}, {"_id": ObjectId("52448e4697fb2b775cb5c3b6")}]
  </code></pre>
  
  <p>However I need to push above array to another document with an update operation like this:</p>
  
  <pre><code>db.statistic.update({"date": today}, {$push: {"children": [ObjectId("52448e4697fb2b775cb5c3a7"), ObjectId("52448e4697fb2b775cb5c3b6")]}}, true, false)
  </code></pre>
  
  <p>I would like to avoid sorting out the document structure, in case it is possible to just return an array containing the appropriate values using mongo</p>