(PECL mongo >=0.9.0)
MongoDB::listCollections — Get a list of collections in this database
This function has no parameters.
Returns a list of MongoCollections.
Example #1 MongoDB::listCollections() example
The following example demonstrates dropping each collection in a database.
<?php
$m = new Mongo();
$db = $m->selectDB("sample");
$list = $db->listCollections();
foreach ($list as $collection) {
echo "removing $collection... ";
$collection->drop();
echo "gone\n";
}
?>
The above example will output something similar to:
removing sample.blog.posts... gone removing sample.critical.docs... gone removing sample.taxes... gone ...