diff --git a/src/Operation/Find.php b/src/Operation/Find.php index 52c43c525..484c71f39 100644 --- a/src/Operation/Find.php +++ b/src/Operation/Find.php @@ -418,6 +418,11 @@ private function createQueryOptions(): array $options['modifiers'] = is_object($modifiers) ? document_to_array($modifiers) : $modifiers; } + // Ensure no cursor is left behind when limit == batchSize by increasing batchSize + if (isset($options['limit'], $options['batchSize']) && $options['limit'] === $options['batchSize']) { + $options['batchSize']++; + } + return $options; } }