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

mongocli iam project team update

On this page

  • Syntax
  • Arguments
  • Options
  • Output
  • Example

The mongocli iam project team update command updates the roles of a team with access to a specified project.

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

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

The unique identifier of the team to update.

You can retrieve a list of team IDs for your project with the iam project 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.

The roles you provide to mongocli iam project team update overwrite the team's existing roles.

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's roles updated.

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 updates a team in an Atlas project to have only the GROUP_READ_ONLY and GROUP_CLUSTER_MANAGER roles. It uses the default profile for accessing Atlas.

mongocli iam project team update 5dd58c647a3e5a6c5bce46c7 --role GROUP_READ_ONLY --role GROUP_CLUSTER_MANAGER -o json

The previous command prints the following in the specified format to the terminal. For more information on these fields, see Output.

[
{
"links": [...],
"roleNames": [
"GROUP_CLUSTER_MANAGER",
"GROUP_READ_ONLY"
],
"teamId": "5f76335aec870a73dd591699"
}
]

Back

List Teams for a Project