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

mongocli iam project team add

On this page

  • Syntax
  • Arguments
  • Options
  • Output
  • Example

The mongocli iam project team add command adds a team to the specified project with the specified roles.

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

mongocli iam project|s team|s add <team-ID>
--role <role>
[ --projectId <projectId> ]
[ --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?
<team-ID>
string

The unique identifier of the team to add to a project.

You can retrieve a list of team IDs for an organization with the iam team list command.

yes
Option
Type
Description
Required?
--role
string
Role or roles to assign to the members of the team for the specified project. To assign more than one role, you can specify each role with a --role flag or specify the roles in a comma-separated list with one --role flag.
yes
--projectId
string
Unique identifier of the project to which to add the team. If omitted, uses the project ID in the profile or environment variable.
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 that contains the access information. If omitted, uses the default profile.
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.

Team added to the project.

The JSON response returns an array of teams with access to the specified project, with the following details about each team:

Field
Description
roleNames
Array of roles granted to users on the team for this project.
teamId
The unique identifier of the team.

The following command adds an organization team to an Atlas project with two Atlas project roles. It uses the default profile for accessing Atlas.

mongocli iam project team add 5dd58c647a3e5a6c5bce46c7 --role GROUP_READ_ONLY --role GROUP_CLUSTER_MANAGER

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

Team added to the project.

Back

Project Teams