Werbung
Mongo::__get
()
Mongo::__get — Gets a database
Beschreibung
This is the cleanest way of getting a database. If the database name has any special characters, Mongo::selectDB() will need to be used. However, in most cases, this should be sufficient.
PHP Code
1
2
3
4
2
3
4
$mongo = new Mongo();
// the following two lines are equivalent
$db = $mongo->selectDB("foo");
$db = $mongo->foo;
Parameter-Liste
- dbname
-
The database name.
Rückgabewerte
Returns a new db object.
Fehler/Exceptions
Throws InvalidArgumentException if the database name is invalid.