- Reference >
mongo
Shell Methods >- Database Methods >
- db.getCollectionInfos()
db.getCollectionInfos()¶
On this page
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 thelistCollections
command.Changed in version 3.2: MongoDB 3.2 added support for document validation.
db.getCollectionInfos()
includes document validation information in theoptions
document.db.getCollectionInfos()
does not returnvalidationLevel
andvalidationAction
unless they are explicitly set.
Example¶
The following returns information for all collections in the
example
database:
The method returns an array of documents that contain collection information:
To request collection information for a specific collection, specify the collection name when calling the method, as in the following:
The method returns an array with a single document that details the
collection information for the restaurants
collection in the
example
database.