We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa24a49 commit 6b7bd02Copy full SHA for 6b7bd02
pymongo/message.py
@@ -252,6 +252,10 @@ def _gen_find_command(
252
if limit < 0:
253
cmd["singleBatch"] = True
254
if batch_size:
255
+ # When limit and batchSize are equal we increase batchSize by 1 to
256
+ # avoid an unnecessary killCursors.
257
+ if limit == batch_size:
258
+ batch_size += 1
259
cmd["batchSize"] = batch_size
260
if read_concern.level and not (session and session.in_transaction):
261
cmd["readConcern"] = read_concern.document
0 commit comments