(PECL mongo >=1.3.0)
A connection manager for PHP and MongoDB.
This class is used to create and manage connections. A typical use is:
Example #1 MongoClient basic usage
<?php
$m = new MongoClient(); // connect
$db = $m->foo; // get the database named "foo"
?>
See MongoClient::__construct() and the section on connecting for more information about creating connections.
NULL
;NULL
;$server
= "mongodb://localhost:27017"
[, array $options
= array("connect" => TRUE
)
[, array $driver_options
]]] )MongoClient::VERSION
MongoClient::DEFAULT_HOST
"localhost"
MongoClient::DEFAULT_PORT
27017
MongoClient::RP_PRIMARY
"primary"
MongoClient::RP_PRIMARY_PREFERRED
"primaryPreferred"
MongoClient::RP_SECONDARY
"secondary"
MongoClient::RP_SECONDARY_PREFERRED
"secondaryPreferred"
MongoClient::RP_NEAREST
"nearest"
TRUE
if we have a open connection
the database based on the ReadPreference and tagsets (for ReplicaSet
connections), FALSE
otherwise. This property does not take
authentication into account.
NULL
In driver
versions 1.1.x and earlier, this may be set to a string value (e.g.
"recycled", "new") when persistent
connections are used.