Php/docs/mongoclient.selectcollection
来自菜鸟教程
MongoClient::selectCollection
(PECL mongo >=1.3.0)
MongoClient::selectCollection — 获取数据库的文档集
This extension that defines this method is deprecated. Instead, the MongoDB extension should be used. There is no equivalent for this method in the new extension, but there is an alternative in the PHP library:
说明
public MongoClient::selectCollection
( string $db
, string $collection
) : MongoCollection
参数
db
- 数据库名
collection
- 文档集名。
返回值
返回一个新的文档集对象。
范例
Example #1 MongoClient::selectCollection() 例子
<?php$m = new MongoClient();$c1 = $m->selectCollection("foo", "bar.baz");// 就等于$c2 = $m->selectDB("foo")->selectCollection("bar.baz");// $c1 和 $c2 现在表示的是同一个文档集?>