Once you have a connection to the MongoDB server, you need to select a database and a collection to access and store data. In PHP, you can select a database and access a collection with two commands.
To select a database, use the selectDB() method on the connection object:
$myDB= $myConnection->selectDB($dbName);
To reference a collection, you can simply get a reference to it off the database object:
$myCollectionName = "test_collection";
$myCollection = $myDB->$myCollectionName;
Note that Mongo will automatically create the referenced database or collection when you access it if it doesn't already exist, so be sure not to make a spelling error.



Del.ici.ous


