Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-5374

batchSize is a hard limit for an in memory sort

    • Type: Icon: Question Question
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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") }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            aaron Aaron Staple
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: