title: MongoDB sort by nested array
body: <p>I am now using mongodb to get what I want.</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "_id" : ObjectId("533b66f3e4b038c01f6a427f"),
    "ccNameCount" : [{
        "ccName" : "ATCC",
        "paperCount" : 4660,
        "strainCount" : 9339,
        "version" : 1
      }, {
        "ccName" : "BCC",
        "paperCount" : 24,
        "strainCount" : 41
      }, {
        "ccName" : "BCCM/DCG",
        "paperCount" : 3,
        "strainCount" : 7
      }]
  }
  </code></pre>
  
  <p>Sample document is just like this.Now , I want to query the documents whose ccNameCount.ccName = ATCC and sort the result by paperCount.But of cource ,since ccNameCount is an array , just sort by the key ccNameCount will not give me what I want.So , my question is ,what can i do?Using MapReduce?</p>