PHP 7.2.7 Released


(PECL mongo >=0.9.0)

MongoDB::selectCollectionLit une collection


public MongoCollection MongoDB::selectCollection ( string $name )

Liste de param├Ętres


Le nom de la collection.

Valeurs de retour

Retourne un nouvel objet de collection.

Erreurs / Exceptions

Lance une Exception si le nom de la collection est invalide.

add a note add a note

User Contributed Notes 1 note

asuquo dot ulo at techxion dot com
3 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