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

mongocli ops-manager dbuser list

On this page

  • Syntax
  • Options
  • Output
  • Example

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

mongocli ops-manager|om dbuser list|ls
[ --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.

Option
Type
Description
Required?
--authDB
string
Name of the authentication database for this user. Defaults to admin.
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.

Field
Description
user
Username of the MongoDB user.
db
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.

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

mongocli ops-manager dbuser list --output json

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 Ops 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"
]
}
]

Back

Database Users