PHP 7.2.25 Released

MongoDB::selectCollection

(PECL mongo >=0.9.0)

MongoDB::selectCollectionGets a collection

Beschreibung

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

Parameter-Liste

name

The collection name.

R├╝ckgabewerte

Returns a new collection object.

Fehler/Exceptions

Throws Exception if the collection name is invalid.

add a note add a note

User Contributed Notes 1 note

up
-17
asuquo dot ulo at techxion dot com
5 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