Skip to content

Commit ed5567a

Browse files
committed
PHPLIB-304: Deprecate methods and classes related to inline results for the aggregate command
1 parent 0d84061 commit ed5567a

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

src/Operation/Aggregate.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
class 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)) {

tests/Operation/AggregateFunctionalTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ function(stdClass $command) {
3030

3131
public function testDefaultWriteConcernIsOmitted()
3232
{
33-
if (version_compare($this->getServerVersion(), '2.6.0', '<')) {
34-
$this->markTestSkipped('$out pipeline operator is not supported');
35-
}
36-
3733
(new CommandObserver)->observe(
3834
function() {
3935
$operation = new Aggregate(

0 commit comments

Comments
 (0)