public function listDBs()
    {
        try {
            $databaseInfoIterator = $this->client->listDatabases();
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }

        $databases = [
            'databases' => [],
            'totalSize' => 0,
            'ok' => 1.0,
        ];

        foreach ($databaseInfoIterator as $databaseInfo) {
            $databases['databases'][] = [
                'name' => $databaseInfo->getName(),
                'empty' => $databaseInfo->isEmpty(),
                'sizeOnDisk' => $databaseInfo->getSizeOnDisk(),
            ];
            $databases['totalSize'] += $databaseInfo->getSizeOnDisk();
        }

        return $databases;
    }
public function listDBs()
    {
        try {
            $databaseInfoIterator = $this->client->listDatabases();
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }

        $databases = [
            'databases' => [],
            'totalSize' => 0,
            'ok' => 1.0,
        ];

        foreach ($databaseInfoIterator as $databaseInfo) {
            $databases['databases'][] = [
                'name' => $databaseInfo->getName(),
                'empty' => $databaseInfo->isEmpty(),
                'sizeOnDisk' => $databaseInfo->getSizeOnDisk(),
            ];
            $databases['totalSize'] += $databaseInfo->getSizeOnDisk();
        }

        return $databases;
    }
public function listDBs ( ) { try { $ databaseInfoIterator = $ this -> client -> listDatabases ( ) ; } catch ( \ MongoDB \ Driver \ Exception \ Exception $ e ) { throw ExceptionConverter :: toLegacy ( $ e ) ; } $ databases = [ 'databases' => [ ] , 'totalSize' => 0 , 'ok' => 1.0 , ] ; foreach ( $ databaseInfoIterator as $ databaseInfo ) { $ databases [ 'databases' ] [ ] = [ 'name' => $ databaseInfo -> getName ( ) , 'empty' => $ databaseInfo -> isEmpty ( ) , 'sizeOnDisk' => $ databaseInfo -> getSizeOnDisk ( ) , ] ; $ databases [ 'totalSize' ] += $ databaseInfo -> getSizeOnDisk ( ) ; } return $ databases ; }
Lists all of the databases available

@link http://php.net/manual/en/mongoclient.listdbs.php
@return array Returns an associative array containing three fields. The first field is databases, which in turn contains an array. Each element of the array is an associative array corresponding to a database, giving the database's name, size, and if it's empty. The other two fields are totalSize (in bytes) and ok, which is 1 if this method ran successfully.
Lists all of the databases available