PHP Portal » PHP Handbuch » MongoDB::__get

Werbung

MongoDB::__get


()

MongoDB::__getGets a collection

Beschreibung

public MongoCollection MongoDB::__get ( string $name )

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
$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.