MongoDB
PHP Manual

MongoDB::getCollectionInfo

(PECL mongo >=1.6.0)

MongoDB::getCollectionInfoReturns information about indexes on this collection

Descrizione

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

Gets a list of all the collections in the database and returns them as an array of documents containing their names and options.

Elenco dei parametri

includeSystemCollections

Include system collections.

Valori restituiti

This function returns an array in which each element describes a collection. Elements will contain the values name for the name of the collection, and optionally an options array to indicate options for a specific collection. Options are things like whether a collection is capped for example.

Esempi

Example #1 MongoDB::getCollectionInfo() example

<?php
$c 
= new MongoClient;
$d $c->test;
$collections $d->getCollectionInfo();
var_dump($collections);
?>

Il precedente esempio visualizzerĂ  qualcosa simile a:

array(2) {
  'book' =>
  array(1) {
    'name' =>
    string(9) "test.book"
  }
  'texttest' =>
  array(2) {
    'name' =>
    string(13) "test.texttest"
    'options' =>
    array(1) {
      'flags' =>
      int(1)
    }
  }
}

Vedere anche:


MongoDB
PHP Manual