downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

MongoClient::getConnections> <MongoClient::dropDB
[edit] Last updated: Sat, 18 May 2013

view this page in

MongoClient::__get

(PECL mongoclient >=1.0.2)

MongoClient::__getGets a database

Description

public MongoDB MongoClient::__get ( string $dbname )

This is the cleanest way of getting a database. If the database name has any special characters, MongoClient::selectDB() will need to be used; however, this should be sufficient for most cases.

<?php

$mongo 
= new MongoClient();

// the following two lines are equivalent
$db $mongo->selectDB("foo");
$db $mongo->foo;

?>

Parameters

dbname

The database name.

Return Values

Returns a new db object.

Errors/Exceptions

Throws a generic exception if the database name is invalid.



add a note add a note User Contributed Notes MongoClient::__get - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites