Navigation

Alpha Release of MongoDB CLI

This is a pre-release early version of MongoDB CLI. Do not use MongoDB CLI to manage production environments.

mongocli atlas measurements databases list

On this page

The measurements 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.

Syntax

mongocli atlas measurements databases list <hostname>:<port>
     [ --limit <number-of-items-per-page> ]
     [ --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.

Options

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
--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 that contains the alerts to retrieve. If omitted, uses the project ID in the profile or environment variable. no

Output

The command prints the following fields in JSON 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 An array of documents, representing a link to one or more sub-resources and/or related resources such as list pagination. See Linking for more information.
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 measurements 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 measurements for the database.

See Linking for more information on links.

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.

Example

The following example uses the mongocli atlas measurements 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 measurements database list atlas-ap6k8a-shard-00-02.qmljy.mongodb.net:27017

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
}