-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Ian tried to do
db.blog.posts.find(
{related:null}).sort(
{ts:-1})
and got back 18427 results. He added a limit:
db.blog.posts.find(
{related:null}).sort(
{ts:-1}).limit(1000)
and got back 315.
I tried it with the Java driver and got similar results (362 docs returned, program attached).
This is on businessinsider:prod.
The explain on the query from PHP said:
array(8) {
["cursor"]=>
string(24) "BtreeCursor ts_1 reverse"
["startKey"]=>
array(1) {
["ts"]=>
array(1)
}
["endKey"]=>
array(1) {
["ts"]=>
array(1)
}
["nscanned"]=>
float(9197)
["n"]=>
int(1000)
["millis"]=>
int(43)
["oldPlan"]=>
array(3) {
["cursor"]=>
string(24) "BtreeCursor ts_1 reverse"
["startKey"]=>
array(1) {
["ts"]=>
array(1)
}
["endKey"]=>
array(1) {
["ts"]=>
array(1)
}
}
["allPlans"]=>
array(2) {
[0]=>
array(3) {
["cursor"]=>
string(24) "BtreeCursor ts_1 reverse"
["startKey"]=>
array(1) {
["ts"]=>
array(1)
}
["endKey"]=>
array(1) {
["ts"]=>
array(1)
}
}
[1]=>
array(3) {
["cursor"]=>
string(11) "BasicCursor"
["startKey"]=>
array(0) {
}
["endKey"]=>
array(0) {
}
}
}
}