title: Project an array with MongoDB
body: <p>I'm using MongoDB's aggregation pipeline, to get my documents in the form that I want. As the last step of aggregation, I use <code>$project</code> to put the documents into their final form.</p>
  
  <p>But I'm having trouble projecting and array of sub-documents. Here is what I currently get from aggrgation:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "_id": "581c8c3df1325f68ffd23386",
    "count": 14,
    "authors": [
      {
        "author": {
          "author": "57f246b9e01e6c6f08e1d99a",
          "post": "581c8c3df1325f68ffd23386"
        },
        "count": 13
      },
      {
        "author": {
          "author": "5824382511f16d0f3fd5aaf2",
          "post": "581c8c3df1325f68ffd23386"
        },
        "count": 1
      }
    ]
  }
  </code></pre>
  
  <p>I want to <code>$project</code> the <code>authors</code> array so that the return would be this:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "_id": "581c8c3df1325f68ffd23386",
    "count": 14,
    "authors": [
      {
        "_id": "57f246b9e01e6c6f08e1d99a",
        "count": 13
      },
      {
        "_id": "5824382511f16d0f3fd5aaf2",
        "count": 1
      }
    ]
  }
  </code></pre>
  
  <p>How would I go about achieving that?</p>