Phalcon\Db\Adapter\MongoDB\Operation\Aggregate::createCommand PHP Method

createCommand() private method

Create the aggregate command.
private createCommand ( MongoDB\Driver\Server $server, boolean $isCursorSupported ) : MongoDB\Driver\Command
$server MongoDB\Driver\Server
$isCursorSupported boolean
return MongoDB\Driver\Command
    private function createCommand(Server $server, $isCursorSupported)
    {
        $cmd = ['aggregate' => $this->collectionName, 'pipeline' => $this->pipeline];
        // Servers < 2.6 do not support any command options
        if (!$isCursorSupported) {
            return new Command($cmd);
        }
        $cmd['allowDiskUse'] = $this->options['allowDiskUse'];
        if (isset($this->options['bypassDocumentValidation']) && Functions::serverSupportsFeature($server, self::$wireVersionForDocumentLevelValidation)) {
            $cmd['bypassDocumentValidation'] = $this->options['bypassDocumentValidation'];
        }
        if (isset($this->options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
        }
        if (isset($this->options['readConcern']) && Functions::serverSupportsFeature($server, self::$wireVersionForReadConcern)) {
            $cmd['readConcern'] = Functions::readConcernAsDocument($this->options['readConcern']);
        }
        if ($this->options['useCursor']) {
            $cmd['cursor'] = isset($this->options["batchSize"]) ? ['batchSize' => $this->options["batchSize"]] : new stdClass();
        }
        return new Command($cmd);
    }