PHP 7.0.6 Released

MongoDB::selectCollection

(PECL mongo >=0.9.0)

MongoDB::selectCollectionGets a collection

Description

public MongoCollection MongoDB::selectCollection ( string $name )

Parameters

name

The collection name.

Return Values

Returns a new collection object.

Errors/Exceptions

Throws Exception if the collection name is invalid.

User Contributed Notes

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