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 8946e5d commit 4407172Copy full SHA for 4407172
src/Operation/Find.php
@@ -30,6 +30,7 @@
30
use MongoDB\Exception\UnsupportedException;
31
use MongoDB\Model\CodecCursor;
32
33
+use function assert;
34
use function is_array;
35
use function is_bool;
36
use function is_integer;
@@ -418,6 +419,12 @@ private function createQueryOptions(): array
418
419
$options['modifiers'] = is_object($modifiers) ? document_to_array($modifiers) : $modifiers;
420
}
421
422
+ // Ensure no cursor is left behind when limit == batchSize by increasing batchSize
423
+ if (isset($options['limit'], $options['batchSize']) && $options['limit'] === $options['batchSize']) {
424
+ assert(is_integer($options['batchSize']));
425
+ $options['batchSize']++;
426
+ }
427
+
428
return $options;
429
430
0 commit comments