PHP Velho Oeste 2024

MongoDB::selectCollection

(PECL mongo >=0.9.0)

MongoDB::selectCollectionコレクションを取得する

説明

public MongoDB::selectCollection ( string $name ) : MongoCollection

パラメータ

name

コレクションの名前。

返り値

コレクションを返します。

エラー / 例外

コレクション名が不正な場合に Exception をスローします。

add a note add a note

User Contributed Notes 1 note

up
-13
asuquo dot ulo at techxion dot com
9 years ago
A simple script that selects a db and collection.

$m = new MongoClient();
   echo "Connection to database successfully<br>";
   // select a database
   $db = $m->test;
   echo "Database test selected<br>";
//select a Collection
   $collection = $db->selectCollection("member");
   echo "Collection member selected succsessfully<br>";
  
?>
To Top