Skip to content

Commit 9002fff

Browse files
committed
Update aggregation docblocks relating to write stages
1 parent 52a5496 commit 9002fff

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/Operation/Aggregate.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ class Aggregate implements Executable
6363
* * batchSize (integer): The number of documents to return per batch.
6464
*
6565
* * bypassDocumentValidation (boolean): If true, allows the write to
66-
* circumvent document level validation. This only applies when the $out
67-
* stage is specified.
66+
* circumvent document level validation. This only applies when an $out
67+
* or $merge stage is specified.
6868
*
6969
* For servers < 3.2, this option is ignored as document level validation
7070
* is not available.
@@ -87,15 +87,14 @@ class Aggregate implements Executable
8787
* * maxTimeMS (integer): The maximum amount of time to allow the query to
8888
* run.
8989
*
90-
* * readConcern (MongoDB\Driver\ReadConcern): Read concern. Note that a
91-
* "majority" read concern is not compatible with the $out stage.
90+
* * readConcern (MongoDB\Driver\ReadConcern): Read concern.
9291
*
9392
* This is not supported for server versions < 3.2 and will result in an
9493
* exception at execution time if used.
9594
*
9695
* * readPreference (MongoDB\Driver\ReadPreference): Read preference.
9796
*
98-
* This option is ignored if the $out stage is specified.
97+
* This option is ignored if an $out or $merge stage is specified.
9998
*
10099
* * session (MongoDB\Driver\Session): Client session.
101100
*
@@ -111,7 +110,7 @@ class Aggregate implements Executable
111110
* mongod/mongos upgrades.
112111
*
113112
* * writeConcern (MongoDB\Driver\WriteConcern): Write concern. This only
114-
* applies when the $out stage is specified.
113+
* applies when an $out or $merge stage is specified.
115114
*
116115
* This is not supported for server versions < 3.4 and will result in an
117116
* exception at execution time if used.
@@ -298,10 +297,10 @@ public function execute(Server $server)
298297
* Create the aggregate command.
299298
*
300299
* @param Server $server
301-
* @param boolean $hasOutStage
300+
* @param boolean $hasWriteStage
302301
* @return Command
303302
*/
304-
private function createCommand(Server $server, $hasOutStage)
303+
private function createCommand(Server $server, $hasWriteStage)
305304
{
306305
$cmd = [
307306
'aggregate' => isset($this->collectionName) ? $this->collectionName : 1,
@@ -337,10 +336,10 @@ private function createCommand(Server $server, $hasOutStage)
337336
}
338337

339338
if ($this->options['useCursor']) {
340-
/* Ignore batchSize if pipeline includes an $out stage, as no
341-
* documents will be returned and sending a batchSize of zero could
342-
* prevent the pipeline from executing at all. */
343-
$cmd['cursor'] = isset($this->options["batchSize"]) && ! $hasOutStage
339+
/* Ignore batchSize if pipeline includes an $out or $merge stage, as
340+
* no documents will be returned and sending a batchSize of zero
341+
* could prevent the pipeline from executing at all. */
342+
$cmd['cursor'] = isset($this->options["batchSize"]) && !$hasWriteStage
344343
? ['batchSize' => $this->options["batchSize"]]
345344
: new stdClass;
346345
}

0 commit comments

Comments
 (0)