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

mongocli iam team user add

On this page

  • Syntax
  • Arguments
  • Options
  • Output
  • Example

The mongocli iam team user add command adds one or more users to a team in the specified organization using the specified profile. Users must be current members of an organization before joining a team.

You must have the Organization Owner role to run this command.

mongocli iam team user add <user-IDs>
--teamId <team-ID>
--orgId <organization-ID>
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]

Note

Use -h or --help to view the command-line help for this command.

Argument
Type
Description
Required?
<user-IDs>
list of strings
List of user IDs to add to the specified team.
yes
Option
Type
Description
Required?
--teamId
string
Unique identifier of the team to which you want to add users.
yes
--orgId
string
Unique identifier of the organization that contains the team.
yes
--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 that contains the access information. If omitted, uses the default profile.
no

The command prints following output in the specified format to the terminal if the command succeeds. If the command returns errors, see Troubleshooting for recommended solutions.

User(s) added to the team.

The JSON response returns an array of all users on the team, with details about each user.

The following command adds two new users to a Atlas organization. It uses the default profile for accessing Atlas.

mongocli iam team user add 5dd58c647a3e5a6c5bce46c7 5dd56c847a3e5a1f363d424d \
--teamId 5f6a5c6c713184005d72fe6e --orgId 5df27c15f10fab55fc6c1234

The previous command prints the following in the default format to the terminal.

User(s) added to the team.

Back

Delete a Team