@@ -63,8 +63,8 @@ class Aggregate implements Executable
63
63
* * batchSize (integer): The number of documents to return per batch.
64
64
*
65
65
* * 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.
68
68
*
69
69
* For servers < 3.2, this option is ignored as document level validation
70
70
* is not available.
@@ -87,15 +87,14 @@ class Aggregate implements Executable
87
87
* * maxTimeMS (integer): The maximum amount of time to allow the query to
88
88
* run.
89
89
*
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.
92
91
*
93
92
* This is not supported for server versions < 3.2 and will result in an
94
93
* exception at execution time if used.
95
94
*
96
95
* * readPreference (MongoDB\Driver\ReadPreference): Read preference.
97
96
*
98
- * This option is ignored if the $out stage is specified.
97
+ * This option is ignored if an $out or $merge stage is specified.
99
98
*
100
99
* * session (MongoDB\Driver\Session): Client session.
101
100
*
@@ -111,7 +110,7 @@ class Aggregate implements Executable
111
110
* mongod/mongos upgrades.
112
111
*
113
112
* * 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.
115
114
*
116
115
* This is not supported for server versions < 3.4 and will result in an
117
116
* exception at execution time if used.
@@ -298,10 +297,10 @@ public function execute(Server $server)
298
297
* Create the aggregate command.
299
298
*
300
299
* @param Server $server
301
- * @param boolean $hasOutStage
300
+ * @param boolean $hasWriteStage
302
301
* @return Command
303
302
*/
304
- private function createCommand (Server $ server , $ hasOutStage )
303
+ private function createCommand (Server $ server , $ hasWriteStage )
305
304
{
306
305
$ cmd = [
307
306
'aggregate ' => isset ($ this ->collectionName ) ? $ this ->collectionName : 1 ,
@@ -337,10 +336,10 @@ private function createCommand(Server $server, $hasOutStage)
337
336
}
338
337
339
338
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
344
343
? ['batchSize ' => $ this ->options ["batchSize " ]]
345
344
: new stdClass ;
346
345
}
0 commit comments