/** * Creates a new database connection object * * @link http://php.net/manual/en/mongo.construct.php * @param string $server The server name. * @param array $options An array of options for the connection. * @param array $driverOptions An array of options for the MongoDB driver. * @throws MongoConnectionException */ public function __construct($server = 'default', array $options = ['connect' => true], array $driverOptions = []) { if ($server === 'default') { $server = 'mongodb://' . self::DEFAULT_HOST . ':' . self::DEFAULT_PORT; } $this->server = $server; $this->client = new Client($server, $options, $driverOptions); $info = $this->client->__debugInfo(); $this->manager = $info['manager']; if (isset($options['connect']) && $options['connect']) { $this->connect(); } }