Reputation: 363
Here is the query:
$collection->find(array("x"=>new MongoId("..."))->skip(5)->limit(10);
Using explain gives the following results:
[n]=>10
[nscanned]=>15
[nscannedObjects]=>15
There is indexing on "x"
. So,if I am skipping the first 5 documents, why the number of scanned objects is 15 and not 10 ?
Upvotes: 1
Views: 10292
Reputation: 42342
Skipping five and then limiting result to ten means that fifteen items need to be considered, the first five will be skipped and the next ten will be returned.
So nscanned should properly be 15.
nscannedObjects should probably be 10, however, due to this bug/limitation, it's also shown as 15.
Upvotes: 5