Docs Menu
Docs Home
/ /
MongoDB Command Line Interface
/ / /

mongocli atlas metrics databases list

On this page

  • Syntax
  • Options
  • Output
  • Example

The metrics databases list command lists available databases on a specified Atlas host.

You can get the hostnames associated with a particular Atlas project with the process list command.

mongocli atlas metrics databases list <hostname>:<port>
[ --limit <number-of-items-per-page> ]
[ --output|-o <output-format> ]
[ --page <page-number> ]
[ --profile|-P <profile-name> ]
[ --projectId <id-of-project> ]

Note

Use -h or --help to view the command-line help for this command.

Option
Type
Description
Required?
--limit
integer
Number of items per page, up to a maximum of 500. Defaults to 100 if omitted.
no
--page
integer
Page number (1-based). Defaults to 1 if not specified.
no
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format

  • go-template for custom output using the Go template

  • go-template-file for custom output specified using Go template file

If omitted, the command returns output in the default format.

no
--profile, -P
string
Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.
no
--projectId
string

Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable.

no

The command prints the following fields in the specified format to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.

Name
Type
Description
links
document array
One or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
results
object array
Each object in the results array represents a single database for the MongoDB process.
results.databaseName
string
Name of the database. You can use the value to retrieve metrics for the database.
results.links
document array

An array containing a single document with the following format:

{
"href" :
"https://cloud.mongodb.com/api/atlas/v1.0/groups/
{GROUP-ID}/processes/{HOST}:{PORT}/databases/{DATABASE-ID}",
"rel" : "self"
}

You can use the href value to retrieve metrics for the database.

The relations between URLs are explained in the Web Linking Specification.

totalCount
number
The total number of items in the result set. This value might be higher than the number of objects in the results array if the entire result set is paginated.

The following example uses the mongocli atlas metrics databases list command to retrieve the available databases for a host with ID atlas-ap6k8a-shard-00-02.qmljy.mongodb.net, listening on port 27017.

mongocli atlas metrics databases list atlas-ap6k8a-shard-00-02.qmljy.mongodb.net:27017 --output json

The command prints the following fields to the terminal. To learn more about these fields, see Output.

{
"links":[
{
"rel":"self",
"href":"https://cloud.mongodb.com/api/atlas/v1.0/groups/12345678/processes/atlas-ap6k8a-shard-00-02.qmljy.mongodb.net:27017/databases?pageNum=1&itemsPerPage=100"
}
],
"results":[
{
"databaseName":"local",
"links":[
{
"href":"https://cloud.mongodb.com/api/atlas/v1.0/groups/12345678/processes/atlas-ap6k8a-shard-00-02.qmljy.mongodb.net:27017/databases/local",
"rel":"self"
}
]
},
{
"databaseName":"sample",
"links":[
{
"href":"https://cloud.mongodb.com/api/atlas/v1.0/groups/12345678/processes/atlas-ap6k8a-shard-00-02.qmljy.mongodb.net:27017/databases/sample",
"rel":"self"
}
]
}
],
"totalCount":2
}

Back

Describe a Database