Werbung
MongoDB::__get
()
MongoDB::__get — Gets a collection
Beschreibung
This is the easiest way of getting a collection from a database object. If a collection name contains strange characters, you may have to use MongoDB::selectCollection() instead.
PHP Code
1
2
3
4
2
3
4
$mongo = new Mongo();
// the following two lines are equivalent
$collection = $mongo->selectDB("foo")->selectCollection("bar");
$collection = $mongo->foo->bar;
Parameter-Liste
- name
-
The name of the collection.
Rückgabewerte
Returns the collection.