OPTIONS

db.getCollectionInfos()

Definition

db.getCollectionInfos()

New in version 3.0.0.

Returns an array of documents with collection information, i.e. collection name and options, for the current database.

The db.getCollectionInfos() helper wraps the listCollections command.

Example

The following returns information for all collections in the records database:

use records
db.getCollectionInfos()

The method returns an array of documents that contain collection information:

[
   {
      "name" : "employees",
      "options" : {
         "flags" : 1
      }
   },
   {
      "name" : "products",
      "options" : {
         "flags" : 1
      }
   },
   {
      "name" : "mylogs",
      "options" : {
         "capped" : true,
         "size" : 256
      }
   },
   {
      "name" : "system.indexes",
      "options" : {
      }
   }
]

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.