title: Increase MongoDB perfomance with sort
body: <p>I have a collection with over 20 million records like this: </p>
  
  <pre class="lang-json prettyprint-override"><code>{
    "_id" : ObjectId("58f8af0f65fc0a38e40a478f"),
    "text" : "Example text",
    "postdate" : NumberLong("1492692751921"),
    "cId" : "58e3cdbe29c8a54394c52c74",
  }
  </code></pre>
  
  <p>And an index like this: <code>{postdate : -1}</code></p>
  
  <p>Of course are there more fields, but this are the most important. Now I want to query for it like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>db.coll.aggregate([
    { "$match" : { 
      "$and" : [ 
        { "postdate" : { "$gt" : 0}} , 
        { "postdate" : { "$lt" : 1497469601983}} , 
        { "cId" : "58e3cdbe29c8a54394c52c74"}
      ]
    }},
    { "$sort" : { "postdate" : -1}},
    { "$limit" : 20}]);
  </code></pre>
  
  <p>But this takes ages. I am wondering if I can increase this performance. I need this query to work faster. What can I do?</p>
  
  <p>Thank you</p>