Please wait while we load your page...
 

Announcements

PHP Manual :: Getting A Collection



Getting a Database || Inserting a Document || Tutorial || PHP Manual

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

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



Getting a Database || Inserting a Document || Tutorial || PHP Manual
Live Chat Not Available