-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.2.0
-
Component/s: None
-
None
-
ALL
Batch size becomes limit if sort is appended to it:
> db.test.insert(
{n: 1})
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.find().batchSize(2).sort(
{n: 1})
{ "_id" : ObjectId("506e43b5681e3dfd1b92980b"), "n" : 1 } { "_id" : ObjectId("506e43b7681e3dfd1b92980c"), "n" : 2 }> db.test.find().batchSize(2)
{ "_id" : ObjectId("506e43b5681e3dfd1b92980b"), "n" : 1 } { "_id" : ObjectId("506e43b7681e3dfd1b92980c"), "n" : 2 } { "_id" : ObjectId("506e43b8681e3dfd1b92980d"), "n" : 3 } { "_id" : ObjectId("506e43b9681e3dfd1b92980e"), "n" : 4 } { "_id" : ObjectId("506e43ba681e3dfd1b92980f"), "n" : 5 }The problem seems to be in the server. I can reproduce the same issue with the Go driver.
- duplicates
-
SERVER-5374 batchSize is a hard limit for an in memory sort
- Closed
- related to
-
SERVER-14228 Setting batchSize and sort on a cursor in sharded collection causes fewer than all documents to be returned
- Closed