Navigation

mongocli atlas dbuser list

On this page

The dbuser list command retrieves the list of MongoDB database users on the specified Atlas cluster. You can also retrieve the MongoDB database users through the Atlas API.

Syntax

mongocli atlas dbuser list
     [ --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?
--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 cluster to update. 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.

Field Description
databaseName User’s authentication database. For MongoDB deployment in Atlas, the authentication database is always the admin database.
groupId

Unique identifier of the Atlas project to which the user belongs.

Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID.

ldapAuthType

Method by which the specified username is authenticated. Valid values are:

NONE Atlas authenticates this user through SCRAM-SHA, not LDAP.
USER LDAP server authenticates this user through the user’s LDAP user.
GROUP LDAP server authenticates this user using their LDAP user and authorizes this user using their LDAP group. To learn more about LDAP security, see Set up User Authentication and Authorization with LDAP.

The default value is NONE.

roles User’s roles and the databases or collections on which the roles apply.
username Username for authentication.

Example

The following example uses the mongocli atlas dbuser list command to retrieve the list of MongoDB database users on the Atlas cluster. The command uses the default profile, which contains the Programmatic API Keys and the project ID.

mongocli atlas dbuser list

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

[
       {
         "roles": [
               {
                     "roleName": "atlasAdmin",
                     "databaseName": "admin"
               }
         ],
         "groupId": "5e2211c17a3e5a48f5497de3",
         "username": "user1",
         "databaseName": "admin",
         "ldapAuthType": "NONE"
       },
       {
         "roles": [
               {
                     "roleName": "atlasAdmin",
                     "databaseName": "admin"
               }
         ],
         "groupId": "5e2211c17a3e5a48f5497de3",
         "username": "user2",
         "databaseName": "admin",
         "ldapAuthType": "NONE"
       },
       {
         "roles": [
               {
                     "roleName": "readWriteAnyDatabase",
                     "databaseName": "admin"
               },
               {
                     "roleName": "clusterMonitor",
                     "databaseName": "admin"
               }
         ],
         "groupId": "5e2211c17a3e5a48f5497de3",
         "username": "user3",
         "databaseName": "admin",
         "ldapAuthType": "NONE"
       }
]