Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5980

Cursor batch absolute maximum size is 4MB

    XMLWordPrintableJSON

Details

    Description

      RE: http://docs.mongodb.org/manual/core/cursors/#cursor-batches

      Subsequent batch size is 4 megabytes. To override the default size of the batch, see batchSize() and limit().

      These 3 things are all orthogonal.

      • The 4MB limit per "getMore" is an absolute compiled-in constant:
        https://github.com/mongodb/mongo/blob/v3.0/src/mongo/db/query/find.cpp#L71
      • The "batchSize" parameter affects how many documents will be returned in a getMore at most (the wording above suggests it can override the 4MB, but it can't, it merely applies as well as the 4MB limit).
      • The "limit" parameter determines the number of documents that can be enumerated by the cursor in total - if that number fits in the first batch then the cursor terminates, but if it doesn't then the cursor batch mechanism works as normal - "limit" can perhaps be thought of as the sum of document counts in all batches.

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            andrew.ryder@mongodb.com Andrew Ryder (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 14 weeks, 1 day ago