note 95047 modified in mongo.selectdb by thiago
| From: | thiago@php.net | Date: | Thu, 10 Dec 2009 18:42:18 +0000 |
| Subject: | note 95047 modified in mongo.selectdb by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163822@lists.php.net to get a copy of this message | ||
There is no listDBs function and the console command 'show dbs' cannot be used with the
PHP bindings, this function gives a list of databases with their size on disk.
<?php
function listDBs(){
$mongo = new Mongo();
$db = $mongo->selectDB('test');
$dbs_ret = $db->execute('new Mongo().getDBs();');
if (!$dbs_ret['ok']){
return false;
}
return $dbs_ret['databases'];
}
?>
--was--
There is no listDBs function and the console command 'show dbs' cannot be used with the
PHP bindings, this function gives a list of databases with their size on disk.
function listDBs(){
$mongo = new Mongo();
$db = $mongo->selectDB('test');
$dbs_ret = $db->execute('new Mongo().getDBs();');
if (!$dbs_ret['ok']){
return false;
}
return $dbs_ret['databases'];
}
http://php.net/manual/en/mongo.selectdb.php