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 cloud-manager dbuser list

On this page

The dbuser list command retrieves the list of MongoDB database users on the specified Cloud Manager clusters in the given project.

Syntax

mongocli cloud-manager|cm dbuser list|ls
     [ --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?
--authDB string Name of the authentication database for this user. Defaults to admin. 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 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
user Username of the MongoDB user.
db User’s authentication database.
roles User’s roles and the databases or collections on which the roles apply.
mechanisms The authentication mechanisms in use by the specified cluster.
scramSha256Creds The user’s SCRAM-SHA-256 credentials. Only appears if the SCRAM-SHA-256 authentication mechanism is in use.
scramSha1Creds The user’s SCRAM-SHA-1 credentials. Only appears if the SCRAM-SHA-251 authentication mechanism is in use.

Example

The following example uses the mongocli cloud-manager dbuser list command to retrieve the list of MongoDB database users on the Cloud Manager cluster. The command uses the profile named myCmProfile, which contains the Programmatic API Keys and the project ID.

~ mongocli cloud-manager dbuser list --profile myCmProfile

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

Note

This output is particular to this Cloud Manager cluster. The output for your cluster may be different.

[
   {
     "user": "user1",
     "db": "admin",
     "roles": [
       {
         "role": "readWriteAnyDatabase",
         "db": "admin"
       }
     ],
     "scramSha256Creds": {
         "iterationCount": 15000,
         "salt": "w3sthRPXyl525zfSe/s77hObK9yU+JotgQ==",
         "serverKey": "zR3mTXUSJayWVsN4UNgONyRvGC4QAnTjQK/K4J4=",
         "storedKey": "kPqSzd01cfzvLy7ihVweV/kjO2pEM81iROgh6g="
     },
     "mechanisms": [
         "SCRAM-SHA-256"
     ]
   },
   {
     "user": "user2",
     "db": "test",
     "roles": [
       {
         "role": "read",
         "db": "test"
       }
     ],
     "scramSha1Creds": {
         "iterationCount": 10000,
         "salt": "9G2BNWxfIRXyacLOTWA==",
         "serverKey": "SxdzrJOsNj9ALtKbdCfju8A=",
         "storedKey": "kVrmPviw9MgNl6Mw/xxZomo="
     },
     "mechanisms": [
       "SCRAM-SHA-1"
     ]
   }
]