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

batchSize is a hard limit for an in memory sort

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: