Docs Menu

Docs HomeLaunch & Manage MongoDBAtlas CLI

atlas dbusers update

On this page

  • Syntax
  • Arguments
  • Options
  • Inherited Options
  • Output
  • Examples

Modify the details of a database user in your project.

To use this command, you must authenticate with a user account or an API key with the Project Owner role.

Command Syntax
atlas dbusers update <username> [options]
Name
Type
Required
Description
username
string
true
Username to update in the MongoDB database.
Name
Type
Required
Description
--authDB
string
false
Authentication database name. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be $external. If the user authenticates with SCRAM-SHA, this value should be admin.
-h, --help
false
help for update
-o, --output
string
false
Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option.
-p, --password
string
false
Password for the database user.
--projectId
string
false
Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
--role
strings
false
User's roles and the databases or collections on which the roles apply. Passing this flag replaces preexisting data.
--scope
strings
false
Array of clusters and Atlas Data Lakes that this user has access to. Passing this flag replaces preexisting data.
-u, --username
string
false
Username for authenticating to MongoDB.
--x509Type
string
false
X.509 method for authenticating the specified username. Valid values include NONE, MANAGED, and CUSTOMER. If you set this to MANAGED the user authenticates with an Atlas-managed X.509 certificate. If you set this to CUSTOMER, the user authenticates with a self-managed X.509 certificate. If you set this to MANAGED or CUSTOMER, you can't set --awsIAMType or --ldapType to any value other than NONE. This value defaults to "NONE".
Name
Type
Required
Description
-P, --profile
string
false
Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.

If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values.

Successfully updated database user '<Username>'.
# Update roles for a database user named myUser for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas dbuser update myUser --role readWriteAnyDatabase --projectId 5e2211c17a3e5a48f5497de3
# Update scopes for a database user named myUser for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas dbuser update myUser --scope resourceName:resourceType --projectId 5e2211c17a3e5a48f5497de3
← atlas dbusers list