title: $natural order avoids indexes. How does orderby effect the use of indexes?
body: <p>Profiling slow queries I found something really strange: For the following operation the entire collection was scanned (33061 documents) even though there is an index on the query parameter family_id:</p>
  
  <pre><code>{
      "ts" : ISODate("2013-11-27T10:20:26.103Z"),
      "op" : "query",
      "ns" : "mydb.zones",
      "query" : {
          "$query" : {
              "family_id" : ObjectId("52812295ea84d249934f3d12")
          },
          "$orderby" : {
              "$natural" : 1
          }
      },
      "ntoreturn" : 20,
      "ntoskip" : 0,
      "nscanned" : 33061,
      "keyUpdates" : 0,
      "numYield" : 91,
      "lockStats" : {
          "timeLockedMicros" : {
              "r" : NumberLong(83271),
              "w" : NumberLong(0)
          },
          "timeAcquiringMicros" : {
              "r" : NumberLong(388988),
              "w" : NumberLong(22362)
          }
      },
      "nreturned" : 7,
      "responseLength" : 2863,
      "millis" : 393,
      "client" : "127.0.0.1",
      "user" : "mydb"
  }
  </code></pre>
  
  <p>After some Google searches without results I found out that leaving out the <code>"$orderby": { "$natural" : 1}</code> the query is very fast and only 7 documents are scanned instead of 33061. So I assume using <code>$orderby</code> in my case does avoid using the index on family_id. The strange thing is that the resulting order is not different in either case. As far as I understand $natural order it is tautologically to use  <code>"$orderby": { "$natural" : 1}</code> or no explicit order. Another very interesting observation is that this issue does not arise on capped collection!!</p>
  
  <p>This issue  arises the following questions:</p>
  
  <ol>
  <li>If not using any ordering/sorting, shouldn't the resulting order be the order on disk, i.e. <code>$natural</code> order?</li>
  <li>Can I create a (compound-)index that would be used sorting naturally?</li>
  <li>How can I invert the ordering of a simple query that uses an index an no sorting without severe performance losses?</li>
  <li>What happens behind the scenes when using query parameters and orderby? Why is this not happening on capped collections? I would like to understand this strange behaviour.</li>
  <li>Are the answers of the above questions independent of whether you use sharding/replication or not? What is the natural order of a query over multiple shards?</li>
  </ol>
  
  <p>Note I am using MongoDB 2.2. There is a ticket related to this issue: <a href="https://jira.mongodb.org/browse/SERVER-5672" rel="nofollow">https://jira.mongodb.org/browse/SERVER-5672</a>. Though it seems in that ticket that the issue occures in capped collections too, which I cannot confirm (maybe due to different mongo versions).</p>