Reputation: 1623
I'm new to mongodb
,when i was going through cursor batches it tells the amount of data in the batch will not exceed the maximum BSON
document size,but when i go through Bson Document Size it tells The maximum BSON document size is 16 megabytes,i can't get whether the batch will be of size 16 megabytes
or each document in batch will 16 megabytes
, how does cursor batch works if my query returns 20 documents
whose minimum size 1mb
Upvotes: 2
Views: 2515
Reputation: 542
When you run a query looking for documents what mongodb
does is it just return the cursor of selected documents,but returning cursor alone is not efficient so we can fetch first batch of results which also add overhead if result set is too large. So, as a compromise and to improve performance what mongodb
does is return the first 101 documents in the initial batch wait for next cursor call after subsequent requests cursors dont have the default size so that it limits to 16mb message size!!!
Upvotes: 1