Details
-
Bug
-
Resolution: Done
-
Minor - P4
-
None
-
1.2.4, 1.3.4
-
None
-
Ubuntu 9.10 x64
Description
If I run a sort query (with limit) on a collection in ascending order, everything operates properly:
> db.signatures.find().sort(
{numbb:1}).limit(10)
{ "_id" : ObjectId("4b980bcb5506ca18cc00000d"), "numbb" : 2, "symbol" : "gen_raw_REG", "type" : "ssig", "signature" : BinData type: 2 len: 67 }.....
But I actually want descending order:
> db.signatures.find().sort(
).limit(10)
error:
Curiously, a smaller limit works properly:
> db.signatures.find().sort(
).limit(3)
{ "_id" : ObjectId("4b980ed75506ca18cc02d6fb"), "_types" : [ "Signature" ], "symbol" : "_ZN8LargeNet13doBuildInsideEv", "numbb" : 6323, "_cls" : "Signature", "signature" : BinData type: 2 len: 2364674, "type" : "ssig" }....
For reference, .limit(4) is apparently too large.
If there's a good reason for this, so be it. I'm guessing, however, that this is due to the query optimizer doing quite different things depending on sort order.