Skip to content

Commit

Permalink
PHPLIB-1564: Increase batchSize for find when it's equal to limit
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Nov 19, 2024
1 parent 8946e5d commit caf7918
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Operation/Find.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit caf7918

Please sign in to comment.