©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
获取一个集合的语法与获取数据库时相同:
<?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 类的文档中有对集合对象的详细说明。
[#1] jerome at chaman dot ca [2015-03-16 21:26:21]
If your collection uses dot notation, get it with MongoDB::selectCollection :
$colors = $db->selectCollection('my.colors');