Phalcon\Db\Adapter\MongoDB\Database::command PHP Method

command() public method

Execute a command on this database.
See also: DatabaseCommand::__construct() for supported options
public command ( array | object $command, array $options = [] ) : MongoDB\Driver\Cursor
$command array | object Command document
$options array Options for command execution
return MongoDB\Driver\Cursor
    public function command($command, array $options = [])
    {
        if (!isset($options['readPreference'])) {
            $options['readPreference'] = $this->readPreference;
        }
        if (!isset($options['typeMap'])) {
            $options['typeMap'] = $this->typeMap;
        }
        $operation = new DatabaseCommand($this->databaseName, $command, $options);
        $server = $this->manager->selectServer($options['readPreference']);
        return $operation->execute($server);
    }