-
Type: Question
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Batch size is a hard limit if the selected plan for a query does an in memory sort. (The first and only batch will have size <= the specified batchSize.) This behavior isn't explicitly described in the docs, so I wanted to check if it's desired.
> c.save( {} ) > c.save( {} ) > c.save( {} ) > c.find().batchSize( 2 ) { "_id" : ObjectId("4f6bc6c16f6654844e41b644") } { "_id" : ObjectId("4f6bc6c16f6654844e41b645") } { "_id" : ObjectId("4f6bc6c56f6654844e41b646") } > c.find().sort( {a:1} ).batchSize( 2 ) { "_id" : ObjectId("4f6bc6c16f6654844e41b644") } { "_id" : ObjectId("4f6bc6c16f6654844e41b645") }
- duplicates
-
SERVER-7694 external sort for find command
- Closed
- is duplicated by
-
SERVER-6015 using sort() with batchSize() never returns an active cursor, therefore incomplete resultsets can be returned
- Closed
-
SERVER-7267 Batch size + sort closes the cursor
- Closed
- related to
-
SERVER-14228 Setting batchSize and sort on a cursor in sharded collection causes fewer than all documents to be returned
- Closed