If your collection uses dot notation, get it with MongoDB::selectCollection :
$colors = $db->selectCollection('my.colors');
获取一个集合的语法与获取数据库时相同:
<?php
$connection = new MongoClient();
$db = $connection->baz;
// select a collection:
$collection = $db->foobar;
// or, directly selecting a database and collection:
$collection = $connection->baz->foobar;
?>
一个集合相当于一张表。(如果你对关系型数据库比较熟悉)
MongoCollection 类的文档中有对集合对象的详细说明。
If your collection uses dot notation, get it with MongoDB::selectCollection :
$colors = $db->selectCollection('my.colors');