Phalcon\Db\Adapter\MongoDB\Client::__construct PHP Method

__construct() public method

This is the preferred class for connecting to a MongoDB server or cluster of servers. It serves as a gateway for accessing individual databases and collections. Supported driver-specific options: * typeMap (array): Default type map for cursors and BSON documents. Other options are documented in MongoDB\Driver\Manager::__construct().
See also: http://docs.mongodb.org/manual/reference/connection-string/
See also: http://php.net/manual/en/mongodb-driver-manager.construct.php
See also: http://php.net/manual/en/mongodb.persistence.php#mongodb.persistence.typemaps
public __construct ( string $uri = 'mongodb://localhost:27017', array $uriOptions = [], array $driverOptions = [] )
$uri string MongoDB connection string
$uriOptions array Additional connection string options
$driverOptions array Driver-specific options
    public function __construct($uri = 'mongodb://localhost:27017', array $uriOptions = [], array $driverOptions = [])
    {
        $driverOptions += ['typeMap' => self::$defaultTypeMap];
        if (isset($driverOptions['typeMap']) && !is_array($driverOptions['typeMap'])) {
            throw InvalidArgumentException::invalidType('"typeMap" driver option', $driverOptions['typeMap'], 'array');
        }
        $this->manager = new Manager($uri, $uriOptions, $driverOptions);
        $this->uri = (string) $uri;
        $this->typeMap = isset($driverOptions['typeMap']) ? $driverOptions['typeMap'] : null;
    }