title: MongoDB request on children array field, give back only matching children
body: <p>I have a collection where docs has children field. The children field is an array containing objects with differents _ids. Children _ids are unique inside one nested array, but same children _ids can be found between docs arrays.</p>
  
  <p>Example collection:</p>
  
  <pre><code>[{
      "_id" : 1,
      "name" : "Chocolate",
      "children" : [ 
          { "_id" : E, "bqt" : 23.26 }, 
          { "_id" : B, "bqt" : 0.093 },
          {..many children..}
      ]
  },{
      "_id" : 2,
      "name" : "Cheese",
      "children" : [ 
          { "_id" : A, "bqt" : 4.55 }, 
          { "_id" : D, "bqt" : 0.044 },
          {..many children..}
      ]
  },{
      "_id" : 3,
      "name" : "Pizza",
      "children" : [ 
          { "_id" : D, "bqt" : 9.35 }, 
          { "_id" : E, "bqt" : 2.31 },
          {..many children..}
      ]
  }]
  </code></pre>
  
  <p>How one can make the following request:</p>
  
  <p>"Which docs contains the child 'E', and what's the 'bqt' value of the matching child?" Give me back the docs WITH ONLY the matching child of each doc, not all of them</p>
  
  <p>Example result:</p>
  
  <pre><code>[{
      "_id" : 1,
      "name" : "Cheese",
      "children" : [ 
          { "_id" : E, "bqt" : 23.26 }
      ]
  },{
      "_id" : 3,
      "name" : "Pizza",
      "children" : [ 
          { "_id" : E, "bqt" : 2.31 }
      ]
  }]
  </code></pre>
  
  <p>More compact example result:</p>
  
  <pre><code>[{
      "_id" : 1,
      "name" : "Cheese",
      "children.bqt" : 23.26
  },{
      "_id" : 3,
      "name" : "Pizza",
      "children.bqt" : 2.31
  }]
  </code></pre>