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

search for in the

Inserting a Document> <Getting a Database
[edit] Last updated: Fri, 24 May 2013

view this page in

Getting A Collection

Getting a collection has the same syntax as getting a database:

<?php
$connection 
= new MongoClient();
$db $connection->baz;

// select a collection:
$collection $db->foobar;

// or, directly selecting a database and collection:
$collection $connection->baz->foobar;
?>

A collection is analogous to a table (if you are familiar with relational databases).

See Also

The API documentation on the MongoCollection class contains more information about collection objects.



add a note add a note User Contributed Notes Getting A Collection - [0 notes]
There are no user contributed notes for this page.

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