From dc0650ecc7107a738966d52c1e9d52af6b44013b Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 19 Nov 2024 10:33:29 +0100 Subject: [PATCH] PHPLIB-1563: set singleBatch option for findOne --- src/Operation/Find.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Operation/Find.php b/src/Operation/Find.php index 484c71f39..48be878db 100644 --- a/src/Operation/Find.php +++ b/src/Operation/Find.php @@ -423,6 +423,10 @@ private function createQueryOptions(): array $options['batchSize']++; } + if (isset($options['limit']) && $options['limit'] === 1) { + $options['singleBatch'] = true; + } + return $options; } }