Docs Menu
Docs Home
/ /
MongoDB CLI
/ / /

mongocli iam users invite

On this page

  • Syntax
  • Options
  • Inherited Options
  • Examples

Create a MongoDB user for your MongoDB application and invite the MongoDB user to your organizations and projects.

A MongoDB user account grants access only to the the MongoDB application. To grant database access, create a database user with mongocli [ops-manager|cloud-manager] dbusers create.

Command Syntax
mongocli iam users invite [options]
Name
Type
Required
Description
--country
string
false
ISO 3166-1 alpha two-letter country code of the user's geographic location. The Atlas CLI requires this option.
--email
string
true
Email address for the user.
--firstName
string
true
First or given name for the user.
-h, --help
false
help for invite
--lastName
string
true
Last name, family name, or surname for the user.
--mobile
string
false
Mobile phone number for the user.
--orgRole
strings
false
Unique 24-digit string that identifies the organization, colon, and the user's role for the organization. Specify this value as orgID:ROLE. To learn which values MCLI accepts, see the Items Enum for roles in the Atlas API spec: https://www.mongodb.com/zh-cn/docs/atlas/reference/api-resources-spec/#operation/createOrganizationInvitation/.
-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.
--password
string
false
Password for the user.
--projectRole
strings
false
Unique 24-digit string that identifies the project, colon, and the user's role for the project. Specify this value as projectID:ROLE. Valid values for ROLE include GROUP_CLUSTER_MANAGER, GROUP_DATA_ACCESS_ADMIN, GROUP_DATA_ACCESS_READ_ONLY, GROUP_DATA_ACCESS_READ_WRITE, GROUP_OWNER, GROUP_READ_ONLY, GROUP_AUTOMATION_ADMIN, GROUP_BACKUP_ADMIN, and GROUP_MONITORING_ADMIN.
--username
string
true
Name that identifies the user. You must specify a valid email address.
Name
Type
Required
Description
-P, --profile
string
false
Name of the profile to use from your configuration file. To learn about profiles for MongoCLI, see https://dochub.mongodb.org/core/atlas-cli-configuration-file.
# Create the MongoDB user with the username user@example.com and invite them to the organization with the ID 5dd56c847a3e5a1f363d424d with ORG_OWNER access:
mongocli iam users invite --email user@example.com --username user@example.com --orgRole 5dd56c847a3e5a1f363d424d:ORG_OWNER --firstName Example --lastName User --country US --output json
# Create the MongoDB user with the username user@example.com and invite them to the project with the ID 5f71e5255afec75a3d0f96dc with GROUP_READ_ONLY access:
mongocli iam users invite --email user@example.com --username user@example.com --projectRole 5f71e5255afec75a3d0f96dc:GROUP_READ_ONLY --firstName Example --lastName User --country US --output json

Back

describe