MONGODBDRIVERMANAGER.__CONSTRUCT(3)					 1				       MONGODBDRIVERMANAGER.__CONSTRUCT(3)

MongoDBnager::__construct - Create new MongoDB Manager

SYNOPSIS
finalpublic MongoDBDriverManager::__construct (string $uri, [array $options], [array $driverOptions]) DESCRIPTION
Constructs a new MongoDBDriverManager object with the specified options. PARAMETERS
o $uri - A mongodb:// connection URI: mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] o $options -Connection string options. Note Specifying options via the $options argument will overwrite any options with the same name in the $uri argument. o $driverOptions - Any driver-specific options not included in MongoDB connection spec. ERRORS
/EXCEPTIONS oThrows InvalidArgumentException on argument parsing errors. oThrows MongoDBDriverRuntimeException if the $uri format is invalid EXAMPLES
Example #1 MongoDBDriverManager.__construct(3) basic examples Connecting to standalone MongoDB node <?php $manager = new MongoDBDriverManager("mongodb://localhost:27017"); ?> Connecting to a replica set <?php $manager = new MongoDBDriverManager("mongodb://rs1.example.com,rs2.example.com/?replicaSet=myReplicaSet"); ?> Connecting to a sharded cluster (i.e. one or more mongos instances) <?php $manager = new MongoDBDriverManager("mongodb://mongos1.example.com,mongos2.example.com/"); ?> Connecting to MongoDB with authentication credentials for a particular user and database. <?php $manager = new MongoDBDriverManager("mongodb://myusername:mypassword@localhost:27017/mydatabase"); ?> SEE ALSO
MongoDBDriverServer::__construct, "Chapter#2 Connecting to MongoDB", Connection string URI format. PHP Documentation Group MONGODBDRIVERMANAGER.__CONSTRUCT(3)