|
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") }
|
|