- Reference >
- Database Commands >
- Diagnostic Commands >
- listDatabases
listDatabases¶
On this page
Definition¶
-
listDatabases¶ The
listDatabasescommand provides a list of all existing databases along with basic statistics about them:The value (e.g.
1) does not affect the output of the command.The
listDatabasesmust run against theadmindatabase, as in the following example:
Output¶
The following is an example of a listDatabases result:
listDatabases returns a document that contains:
- A field named
databaseswhose value is an array of documents, one document for each database. Each document contains anamefield with the database name, asizeOnDiskfield with the total size of the database file on disk in bytes, and anemptyfield specifying whether the database has any data. - A field named
totalSizewhose value is the sum of all thesizeOnDiskfields. - A field named
okwhose value determines the success of thelistDatabasescommands.1indicates success.
See also