mongocli iam project list
The mongocli iam project list
command retrieves projects in an
organization using the specified profile.
You must have the Organization Owner
role to retrieve all projects
in an organization. If you have lesser permissions, the command
retrieves only the project for which you are the Project Owner
.
For Ops Manager deployments, you can also use a Personal API Key to retrieve all projects in all organizations.
Syntax
mongocli iam project list [ --orgId <organization-ID> ] [ --output|-o <output-format> ] [ --profile|-P <profile-name> ] [ --limit <integer> ] [ --page <integer> ]
Note
Use -h
or --help
to view the command-line help for
this command.
Options
Option | Type | Description | Required? |
---|---|---|---|
--orgId | string | Unique identifier of the organization that contains the projects
to retrieve. If omitted, retrieves all projects to which the
API key has access. | no |
--output , -o | string | Command output format. Valid values are:
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 |
--limit | integer | Number of projects to return from the result set.
| no |
--page | integer | Starting chunk of projects to return from the result set. The
| no |
Output
The command prints the following fields in the specified format to the terminal if the command succeeds. If the command returns errors, see Troubleshooting for recommended solutions.
The JSON document includes an array of result objects, an array of link objects and a count of the total number of result objects retrieved.
Field | Description |
---|---|
links | Array includes one or more links to sub-resources
and/or related resources. The relations between URLs are
explained in the Web Linking Specification. |
results | Array includes one object for each item detailed in the
results Embedded Document. |
totalCount | Integer count of the total number of items in the result set. It
may be greater than the number of objects in the
results array if the entire result set is paginated. |
results
Embedded Document
Each result is one project.
Field | Description |
---|---|
hostCounts | Number of primary, secondary, slave, arbiter, config, master,
and mongos nodes in the clusters in the project. |
id | Unique identifier of the project in the organization. |
links | Configuration information for accessing the project including
the URL. |
name | Name of the project. |
orgId | Unique identifier of the organization that contains the
project. |
publicApiEnabled | Flag that indicates whether or not programmatic access is enabled for the project. Value can be:
|
Examples
Retrieve All Projects in One Organization
The following command retrieves the list of projects in an Ops Manager organization. It uses the default profile for accessing Ops Manager.
mongocli iam project list --orgId 5e2f05fef10fab66c7d408b3 --output json
This command returns the following JSON document. To learn more about these fields, see Output.
{ "links": [ { "rel": "self", "href": "http://www.example.com:8080/api/public/v1.0/orgs/5e332f3e1234de007b387a9f/groups?pageNum=1\u0026itemsPerPage=100" } ], "results": [ { "hostCounts": { "arbiter": 0, "config": 0, "master": 0, "mongos": 0, "primary": 0, "secondary": 0, "slave": 0 }, "id": "5e332f4e1234de007b387aa3", "links": [ { "rel": "self", "href": "http://www.example.com:8080/api/public/v1.0/groups/5e332f4e1234de007b387aa3" } ], "name": "Project1", "orgId": "5e332f3e1234de007b387a9f", "publicApiEnabled": true }, { "hostCounts": { "arbiter": 0, "config": 0, "master": 0, "mongos": 0, "primary": 0, "secondary": 0, "slave": 0 }, "id": "5e33b9411234de007b38bc1e", "links": [ { "rel": "self", "href": "http://www.example.com:8080/api/public/v1.0/groups/5e33b9411234de007b38bc1e" } ], "name": "Project2", "orgId": "5e332f3e1234de007b387a9f", "publicApiEnabled": true } ], "totalCount": 2 }
Retrieve 5 Projects from across All Organizations
The following command retrieves the projects 6 through 10 across all Atlas organizations. It uses the default profile for accessing Atlas.
mongocli iam project list --limit 5 --page 2 --output json
This command returns the following JSON document. To learn more about these fields, see Output.
{ "links": [ { "rel": "self", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups?pageNum=2\u0026itemsPerPage=5" }, { "rel": "previous", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups?itemsPerPage=5\u0026pageNum=1" }, { "rel": "next", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups?itemsPerPage=5\u0026pageNum=3" } ], "results": [ { "id": "5e332f4e1234de007b387aa3", "orgId": "5e332f3e1234de007b387a9f", "name": "Project1", "created": "2020-01-07T04:34:26Z", "links": [ { "rel": "self", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5e332f4e1234de007b387aa3" } ] }, { "id": "5e33b9411234de007b38bc1e", "orgId": "5e332f3e1234de007b387a9f", "name": "Project2", "created": "2019-12-03T20:02:52Z", "links": [ { "rel": "self", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5e33b9411234de007b38bc1e" } ] }, { "id": "a5b5606160159a77bfee4a2d", "orgId": "98e92ec52cf7b195038af8db", "name": "Project3", "clusterCount": 5, "created": "2019-11-21T17:05:40Z", "links": [ { "rel": "self", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/a5b5606160159a77bfee4a2d" } ] }, { "id": "b01b38b8b7d425cb7adc67f4", "orgId": "ab3b385e950be1704ee793eb", "name": "Project4", "created": "2020-04-10T13:43:02Z", "links": [ { "rel": "self", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/b01b38b8b7d425cb7adc67f4" } ] }, { "id": "4ac2b6c58c19901a414a92a7", "orgId": "fc72af09e65fddadaa4dd9ca", "name": "Project5", "clusterCount": 1, "created": "2020-05-13T15:47:58Z", "links": [ { "rel": "self", "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/4ac2b6c58c19901a414a92a7" } ] } ], "totalCount": 94284 }