Php/docs/mongoclient.selectcollection

提供:Dev Guides
< Php
移動先:案内検索

MongoClient::selectCollection

(PECL mongo >=1.3.0)

MongoClient::selectCollectionGets a database collection


このメソッドを定義している拡張モジュールは非推奨です。 かわりに MongoDB 拡張モジュールを使うべきです。 このメソッドの代替は、新しい拡張モジュールには存在しません。しかし、かわりに使える PHP ライブラリ があります。


説明

public MongoClient::selectCollection ( string $db , string $collection ) : MongoCollection

パラメータ

db
The database name.
collection
The collection name.


返り値

Returns a new collection object.


エラー / 例外

Throws Exception if the database or collection name is invalid.


例1 MongoClient::selectCollection() example

<?php$m = new MongoClient();$c1 = $m->selectCollection("foo", "bar.baz");// which is equivalent to$c2 = $m->selectDB("foo")->selectCollection("bar.baz");// $c1 and $c2 now represent the same collection?>