4141class Aggregate implements Executable
4242{
4343 private static $ wireVersionForCollation = 5 ;
44- private static $ wireVersionForCursor = 2 ;
4544 private static $ wireVersionForDocumentLevelValidation = 4 ;
4645 private static $ wireVersionForReadConcern = 4 ;
4746 private static $ wireVersionForWriteConcern = 5 ;
@@ -100,9 +99,6 @@ class Aggregate implements Executable
10099 * * useCursor (boolean): Indicates whether the command will request that
101100 * the server provide results using a cursor. The default is true.
102101 *
103- * For servers < 2.6, this option is ignored as aggregation cursors are
104- * not available.
105- *
106102 * For servers >= 2.6, this option allows users to turn off cursors if
107103 * necessary to aid in mongod/mongos upgrades.
108104 *
@@ -238,16 +234,15 @@ public function execute(Server $server)
238234 }
239235
240236 $ hasOutStage = \MongoDB \is_last_pipeline_operator_out ($ this ->pipeline );
241- $ isCursorSupported = \MongoDB \server_supports_feature ($ server , self ::$ wireVersionForCursor );
242237
243- $ command = $ this ->createCommand ($ server, $ isCursorSupported );
238+ $ command = $ this ->createCommand ($ server );
244239 $ options = $ this ->createOptions ($ hasOutStage );
245240
246241 $ cursor = $ hasOutStage
247242 ? $ server ->executeReadWriteCommand ($ this ->databaseName , $ command , $ options )
248243 : $ server ->executeReadCommand ($ this ->databaseName , $ command , $ options );
249244
250- if ($ isCursorSupported && $ this ->options ['useCursor ' ]) {
245+ if ($ this ->options ['useCursor ' ]) {
251246 if (isset ($ this ->options ['typeMap ' ])) {
252247 $ cursor ->setTypeMap ($ this ->options ['typeMap ' ]);
253248 }
@@ -272,22 +267,16 @@ public function execute(Server $server)
272267 * Create the aggregate command.
273268 *
274269 * @param Server $server
275- * @param boolean $isCursorSupported
276270 * @return Command
277271 */
278- private function createCommand (Server $ server, $ isCursorSupported )
272+ private function createCommand (Server $ server )
279273 {
280274 $ cmd = [
281275 'aggregate ' => $ this ->collectionName ,
282276 'pipeline ' => $ this ->pipeline ,
283277 ];
284278 $ cmdOptions = [];
285279
286- // Servers < 2.6 do not support any command options
287- if ( ! $ isCursorSupported ) {
288- return new Command ($ cmd );
289- }
290-
291280 $ cmd ['allowDiskUse ' ] = $ this ->options ['allowDiskUse ' ];
292281
293282 if (isset ($ this ->options ['bypassDocumentValidation ' ]) && \MongoDB \server_supports_feature ($ server , self ::$ wireVersionForDocumentLevelValidation )) {
0 commit comments