[SERVER-117] limit() is returning less than it should Created: 25/Jun/09  Updated: 06/Jul/09  Resolved: 25/Jun/09

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kristina Chodorow (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Java Source File Tester.java    
Participants:

 Description   

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)

{ ["$maxElement"]=> int(1) }

}
["endKey"]=>
array(1) {
["ts"]=>
array(1)

{ ["$minElement"]=> int(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)

{ ["$maxElement"]=> int(1) }

}
["endKey"]=>
array(1) {
["ts"]=>
array(1)

{ ["$minElement"]=> int(1) }

}
}
["allPlans"]=>
array(2) {
[0]=>
array(3) {
["cursor"]=>
string(24) "BtreeCursor ts_1 reverse"
["startKey"]=>
array(1) {
["ts"]=>
array(1)

{ ["$maxElement"]=> int(1) }

}
["endKey"]=>
array(1) {
["ts"]=>
array(1)

{ ["$minElement"]=> int(1) }

}
}
[1]=>
array(3) {
["cursor"]=>
string(11) "BasicCursor"
["startKey"]=>
array(0) {
}
["endKey"]=>
array(0) {
}
}
}
}



 Comments   
Comment by Eliot Horowitz (Inactive) [ 25/Jun/09 ]

was a java driver problem - fixed.

Generated at Thu Feb 08 02:53:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.