Navigation

mongocli atlas dbuser certs list

On this page

The dbuser certs list command retrieves the list of unexpired Atlas-managed X.509 certificates for the specified MongoDB database user who authenticates using X.509 certificates. You can also list the Atlas-managed X.509 certificates for a MongoDB database user through the Atlas UI or API.

Important

You cannot use the dbuser certs list command to list certificates for MongoDB database users if:

  • You are managing your own Certificate Authority (CA) in Self-Managed X.509 mode, or
  • The user you specify does not authenticate using X.509 certificates.

Syntax

mongocli atlas dbuser certs list|ls <username>
     [ --output|-o <output-format> ]
     [ --profile|-P <profile-name> ]
     [ --projectId <project-ID> ]

Note

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

Options

Option Type Description Required?
--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 that contains the MongoDB database user. If omitted, uses the project ID in the profile or environment variable. no
<username> string Username for whom you want to list Atlas-managed X.509 certificates. yes

Output

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.

Field Description
id Serial number of the certificate.
createdAt Timestamp in ISO 8601 date and time format in UTC when Atlas created this X.509 certificate.
groupId Unique identifier of the Atlas project to which this certificate belongs.
notAfter Timestamp in ISO 8601 date and time format in UTC when this certificate expires.
subject Full distinguished name of the database user to which this certificate belongs. To learn more, see RFC 2253.

Example

The following example uses the mongocli atlas dbuser certs list command to retrieve the list of unexpired Atlas-managed X.509 certificates for the MongoDB database user dbuser. It uses the default profile to access Atlas and retrieve the list of X.509 certificates.

mongocli atlas dbuser certs list dbuser --output json
--projectId 5e2211c17a3e5a48f5497de3

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

[
  {
    "_id": 7410558049103803930,
    "createdAt": "2020-08-04T14:52:31Z",
    "groupId": "5e2211c17a3e5a48f5497de3",
    "notAfter": "2020-11-04T15:52:31Z",
    "subject": "CN=dbuser"
  },
  {
    "_id": 3226318451840077148,
    "createdAt": "2020-08-04T14:53:35Z",
    "groupId": "5e2211c17a3e5a48f5497de3",
    "notAfter": "2020-11-04T15:53:35Z",
    "subject": "CN=dbuser"
  },
  {
    "_id": 8138860319637071322,
    "createdAt": "2020-08-04T16:55:06Z",
    "groupId": "5e2211c17a3e5a48f5497de3",
    "notAfter": "2020-11-04T17:55:06Z",
    "subject": "CN=dbuser"
  }
]