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

mongocli iam projects users list

On this page

  • Permissions Required
  • Syntax
  • Options
  • Output
  • Example

The mongocli iam projects users list command lists users in the MongoDB service project. You can also retrieve the users in your projects through the:

  • Atlas UI and API

  • Cloud Manager UI and API

  • Ops Manager UI and API

The following table shows the role you must have in your MongoDB service to list the users in your project:

MongoDB Service
Role

Atlas

Cloud Manager

Ops Manager

mongocli iam projects users list
[ --limit <integer> ]
[ --output|-o <output-format> ]
[ --page <integer> ]
[ --profile|-P <profile-name> ]
[ --projectId <project-ID> ]

Note

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

Option
Type
Description
Required?
--limit
integer

Number of projects to return from the result set.

  • If omitted, returns all projects.

  • If this value exceeds the number of projects, mongocli returns all projects.

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
--page
integer

Starting chunk of projects to return from the result set. The --limit flag sets the number of projects per page.

  • If omitted, returns the first page.

  • If this value exceeds the number of pages, mongocli returns the last page.

no
--profile, -P
string
Name of the profile that contains the access information. If omitted, uses the default profile.
no
--projectId
string
Unique identifier of the project for which to retrieve the users. If omitted, uses the specified profile to access the MongoDB service project.
no

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

ID FIRST NAME LAST NAME USERNAME
<user-ID> <first-name> <last-name> <username>

The above default output is a subset of the fields returned by this command. For the complete list of JSON fields returned by the command, see the API reference for your MongoDB service:

The following command lists users in the specified Cloud Manager project. It uses a profile named cmProfile for accessing Cloud Manager.

mongocli iam projects users list --projectId 5e84b94c003f2d6370004f4e --profile cmProfile

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

ID FIRST NAME LAST NAME USERNAME
5dd559c17a3e5a1f363ba8ea John Doe john.doe@example.com

The following command lists users in an Atlas project. It uses the default profile for accessing Atlas.

mongocli iam projects users list --output json

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

[
{
"id": "5f6e2c02a2dcef512bf0f169",
"emailAddress": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"links": [
{
"rel": "self",
"href": "http://example.mongodb.com/api/atlas/v1.0/users/5f6e2c02a2dcef512bf0f169"
}
],
"roles": [
{
"roleName": "GROUP_OWNER",
"groupId": "5f6e2c04a2dcef512bf0f171"
},
{
"roleName": "GROUP_OWNER",
"groupId": "5f6e2ebba2dcef512bf0f82d"
}
],
"username": "john.doe@example.com"
}
]

Back

List Organization Users