- Reference >
- Database Commands >
- Diagnostic Commands >
- listDatabases
listDatabases¶
On this page
Definition¶
-
listDatabases
¶ The
listDatabases
command 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
listDatabases
must run against theadmin
database, as in the following example:
Output¶
The following is an example of a listDatabases
result:
listDatabases
returns a document that contains:
- A field named
databases
whose value is an array of documents, one document for each database. Each document contains aname
field with the database name, asizeOnDisk
field with the total size of the database file on disk in bytes, and anempty
field specifying whether the database has any data. - A field named
totalSize
whose value is the sum of all thesizeOnDisk
fields. - A field named
ok
whose value determines the success of thelistDatabases
commands.1
indicates success.
See also