Commit ed5567a1 authored by Katherine Walker's avatar Katherine Walker

PHPLIB-304: Deprecate methods and classes related to inline results for the aggregate command

parent 0d84061d
...@@ -41,7 +41,6 @@ use Traversable; ...@@ -41,7 +41,6 @@ use Traversable;
class Aggregate implements Executable class Aggregate implements Executable
{ {
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
private static $wireVersionForCursor = 2;
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
private static $wireVersionForWriteConcern = 5; private static $wireVersionForWriteConcern = 5;
...@@ -100,9 +99,6 @@ class Aggregate implements Executable ...@@ -100,9 +99,6 @@ class Aggregate implements Executable
* * useCursor (boolean): Indicates whether the command will request that * * useCursor (boolean): Indicates whether the command will request that
* the server provide results using a cursor. The default is true. * the server provide results using a cursor. The default is true.
* *
* For servers < 2.6, this option is ignored as aggregation cursors are
* not available.
*
* For servers >= 2.6, this option allows users to turn off cursors if * For servers >= 2.6, this option allows users to turn off cursors if
* necessary to aid in mongod/mongos upgrades. * necessary to aid in mongod/mongos upgrades.
* *
...@@ -238,16 +234,15 @@ class Aggregate implements Executable ...@@ -238,16 +234,15 @@ class Aggregate implements Executable
} }
$hasOutStage = \MongoDB\is_last_pipeline_operator_out($this->pipeline); $hasOutStage = \MongoDB\is_last_pipeline_operator_out($this->pipeline);
$isCursorSupported = \MongoDB\server_supports_feature($server, self::$wireVersionForCursor);
$command = $this->createCommand($server, $isCursorSupported); $command = $this->createCommand($server);
$options = $this->createOptions($hasOutStage); $options = $this->createOptions($hasOutStage);
$cursor = $hasOutStage $cursor = $hasOutStage
? $server->executeReadWriteCommand($this->databaseName, $command, $options) ? $server->executeReadWriteCommand($this->databaseName, $command, $options)
: $server->executeReadCommand($this->databaseName, $command, $options); : $server->executeReadCommand($this->databaseName, $command, $options);
if ($isCursorSupported && $this->options['useCursor']) { if ($this->options['useCursor']) {
if (isset($this->options['typeMap'])) { if (isset($this->options['typeMap'])) {
$cursor->setTypeMap($this->options['typeMap']); $cursor->setTypeMap($this->options['typeMap']);
} }
...@@ -272,10 +267,9 @@ class Aggregate implements Executable ...@@ -272,10 +267,9 @@ class Aggregate implements Executable
* Create the aggregate command. * Create the aggregate command.
* *
* @param Server $server * @param Server $server
* @param boolean $isCursorSupported
* @return Command * @return Command
*/ */
private function createCommand(Server $server, $isCursorSupported) private function createCommand(Server $server)
{ {
$cmd = [ $cmd = [
'aggregate' => $this->collectionName, 'aggregate' => $this->collectionName,
...@@ -283,11 +277,6 @@ class Aggregate implements Executable ...@@ -283,11 +277,6 @@ class Aggregate implements Executable
]; ];
$cmdOptions = []; $cmdOptions = [];
// Servers < 2.6 do not support any command options
if ( ! $isCursorSupported) {
return new Command($cmd);
}
$cmd['allowDiskUse'] = $this->options['allowDiskUse']; $cmd['allowDiskUse'] = $this->options['allowDiskUse'];
if (isset($this->options['bypassDocumentValidation']) && \MongoDB\server_supports_feature($server, self::$wireVersionForDocumentLevelValidation)) { if (isset($this->options['bypassDocumentValidation']) && \MongoDB\server_supports_feature($server, self::$wireVersionForDocumentLevelValidation)) {
......
...@@ -30,10 +30,6 @@ class AggregateFunctionalTest extends FunctionalTestCase ...@@ -30,10 +30,6 @@ class AggregateFunctionalTest extends FunctionalTestCase
public function testDefaultWriteConcernIsOmitted() public function testDefaultWriteConcernIsOmitted()
{ {
if (version_compare($this->getServerVersion(), '2.6.0', '<')) {
$this->markTestSkipped('$out pipeline operator is not supported');
}
(new CommandObserver)->observe( (new CommandObserver)->observe(
function() { function() {
$operation = new Aggregate( $operation = new Aggregate(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment