Mongo::forceError
Mongo::lastError
Mongo
PHP Manual

# Mongo::__get

(PECL mongo >=1.0.2)

Mongo::__get — Gets a database

### 説明

public MongoDB Mongo::__get ( string `$dbname` )

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
$mongo = new Mongo();
// the following two lines are equivalent
$db = $mongo->selectDB("foo");
$db = $mongo->foo;
?>`

### パラメータ

`dbname`

  The database name.

### 返り値

Returns a new db object.

### エラー / 例外

Throws a generic exception if the database name is invalid.

Mongo::forceError
Mongo::lastError
Mongo
PHP Manual