MongoDB
PHP Manual

MongoDB::getCollectionNames

(PECL mongo >=1.3.0)

MongoDB::getCollectionNamesGet all collections from this database

Beschreibung

public array MongoDB::getCollectionNames ([ bool $includeSystemCollections = false ] )

Returns an array of all the collection names for the given database.

Parameter-Liste

includeSystemCollections

Include system collections.

Rückgabewerte

Returns the names of the all the collections in the database as an array.

Beispiele

Beispiel #1 MongoDB::getCollectionNames() example

<?php

$m 
= new Mongo;
$collections $m->selectDB("demo")->getCollectionNames());'
var_dump($collections);

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

array(2) {
  [0]=>
  string(9) "addresses"
  [1]=>
  string(5) "users"
}

Siehe auch


MongoDB
PHP Manual