Akash
Akash

Reputation: 295

What is 'size' in pymongo's Cursor.batch_size(size)?

From version 1.9, pymongo added the option to change the batch size of a cursor operation See description here.

But they don't say anywhere what this size is supposed to mean. Is this the number of records to fetch at a time? Or is this absolute size?

Also, what is the default size for the cursor? I checked __dict__ for the Cursor, and it says batch_size is 0.

Upvotes: 1

Views: 3337

Answers (1)

mpobrien
mpobrien

Reputation: 4962

The batch size refers to the number of results that are retrieved with the cursor before issuing a getMore message to fetch more results. The default is 101 documents.

Edit: Sorry, I should clarify - the default is actually set by the server, but as of the current latest release it is 101.

Upvotes: 4

Related Questions