Navigation

Alpha Release of MongoDB CLI

This is a pre-release early version of MongoDB CLI. Do not use MongoDB CLI to manage production environments.

mongocli iam project list

On this page

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> ]
     [ --profile|-p <profile-name> ]

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
--profile, -p string Name of the profile that contains the access information. If omitted, uses the default profile. no

Output

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

Field Description
links Configuration information for accessing the organization including the URL.
results Command results returned as an object that contains multiple project objects.
results.hostCounts Number of primary, secondary, slave, arbiter, config, master, and mongos nodes in the clusters in the project.
results.id Unique identifier of the project in the organization.
results.links Configuration information for accessing the project including the URL.
results.name Name of the project.
results.orgId Unique identifier of the organization that contains the project.
results.publicApiEnabled

Flag that indicates whether or not programmatic access is enabled for the project. Value can be:

  • true if enabled
  • false if disabled
totalCount The total number of projects in the specified organization.

Examples

The following command retrives the list of projects in an Ops Manager organization. It uses the profile named OM-profile for accessing Ops Manager.

mongocli iam project list --orgId 5e2f05fef10fab66c7d408b3 --profile OM-profile

The previous command prints the following in JSON format to the terminal. For more information on 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
}