MongoClient::listDBs

(PECL mongo >=1.3.0)

MongoClient::listDBs�г�������Ч���ݿ�

This extension that defines this method is deprecated. Instead, the MongoDB extension should be used. There is no equivalent for this method in the new extension, but there is an alternative in the PHP library:

˵��

public MongoClient::listDBs ( void ) : array

����

�˺���û�в�����

����ֵ

���صĹ�����������������ֶΡ� ��һ���ֶ��� databases�����������һ�����顣ÿ��Ԫ�ض�Ӧһ�����ݿ⣬�������ݿ����ơ��ߴ��Լ��Ƿ�Ϊ�ա� ���������ֶ��� totalSize����λΪ�ֽ� bytes���� ok����������ɹ����У������� 1��

����

Example #1 MongoClient::listDBs() ����

������ʾ������г����ݿ⣬���������ݵĽṹ��

<?php

$mongo 
= new MongoClient();
$dbs $mongo->listDBs();
print_r($dbs);

?>

�������̵���������ڣ�

Array
(
    [databases] => Array
        (
            [0] => Array
                (
                    [name] => doctrine
                    [sizeOnDisk] => 218103808
                    [empty] =>
                )
        )

    [totalSize] => 218103808
    [ok] => 1
)