title: How to get all subfields of mongodb in a query when one field is root field of other field requested?
body: <p>For this specific case, everything works fine, except when
  for the fields <code>field1</code>,<code>field2</code> requested, and <code>field1</code> is a part of <code>field2</code>.</p>
  
  <p>Example :</p>
  
  <pre><code>&gt; db.mycoll.findOne()
  {
      "_id" : 1,
      "data" : {
          "amounts" : {
              "dollar" : 20,
              "euro" : 18
          },
          "item" : "toy",
          "sale" : false
      }
  }
  
     // works well
  &gt; db.mycoll.findOne({"_id":1},{ "data.amounts.dollar":1 })
  { "_id" : 1, "data" : { "amounts" : { "dollar" : 20 } } }
  
  
  
     // here "data" is root of "data.amounts.dollar" and "data.amounts.euro" 
     //   takes preference, how to query for "data", so 
     //   that all subfields of data are 
     //     returned
  &gt; db.mycoll.findOne({"_id":1},{ "data":1 , "data.amounts.dollar":1 })
  { "_id" : 1, "data" : { "amounts" : { "dollar" : 20 } } }
  </code></pre>
  
  <p>Expected output :</p>
  
  <pre><code> {
          "_id" : 1,
          "data" : {
              "amounts" : {
                  "dollar" : 20,
                  "euro" : 18
              },
              "item" : "toy",
              "sale" : false
          }
      }
  </code></pre>
  
  <p>Yes, it is possible to format the subfields on the program side, and send the root field to mongodb query, but my question is if this is feasible on the querying side without Javascript .</p>