public function __construct($db = null)
{
if ($db) {
if (!extension_loaded('mongo')) {
throw new mongoExtensionNotInstalled();
}
try {
$this->_db = $this->_mongo();
$this->mongo = $this->_db->selectDB($db);
} catch (MongoConnectionException $e) {
throw new cannotConnectToMongoServer();
}
}
}