title: Is it possible to flatten MongoDB result query?
body: <p>I have a deeply nested collection in my MongoDB collection. </p>
  
  <p>When I run the following query:</p>
  
  <pre><code>db.countries.findOne({},{'data.country.neighbor.name':1,'_id':0})
  </code></pre>
  
  <p>I end up with this nested result here:</p>
  
  <pre><code>{"data" : {
    "country" : [
      {
        "neighbor" : [
          {
            "name" : "Austria"
          },
          {
            "name" : "Switzerland"
          }
        ]
      },
      {
        "neighbor" : {
          "name" : "Malaysia"
        }
      },
      {
        "neighbor" : [
          {
            "name" : "Costa Rica"
          },
          {
            "name" : "Colombia"
          }
        ]
      }
    ]
  }}
  </code></pre>
  
  <p>Now, this is what I want:</p>
  
  <pre><code>['Austria', 'Switzerland', 'Malaysia', 'Costa Rica', 'Colombia']
  </code></pre>
  
  <p>or this:</p>
  
  <pre><code>{'name':['Austria', 'Switzerland', 'Malaysia', 'Costa Rica', 'Colombia']}
  </code></pre>
  
  <p>or anything else similar...  Is this possible?</p>