[DOCS-5980] Cursor batch absolute maximum size is 4MB Created: 05/Aug/15  Updated: 30/Oct/23  Resolved: 01/Nov/22

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Andrew Ryder (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 1 year, 14 weeks, 1 day ago
Epic Link: DOCSP-1769

 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.


 Comments   
Comment by Education Bot [ 01/Nov/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Comment by Ronald Chen [ 30/Sep/19 ]

Now 16 MB in 4.2

Generated at Thu Feb 08 07:51:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.