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 org list

On this page

The mongocli iam org list command lists organizations for the specified Ops Manager.

When you use a Programmatic API Key, the command retrieves only the organization of the project whose API key has the Project Owner role.

To list all organizations in your Ops Manager, you must use a Personal API Key.

You can also list organizations through the API.

Syntax

mongocli iam org list
     [ --profile|-p <profile-name> ]

Note

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

Options

Option Type Description Required?
-p | --profile string Name of the profile that contains the access information. If omitted, uses the default profile. no

Output

The command prints the following JSON document 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 section.
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 organization.

Name Description
id
  • Unique identifier for the organization.
links One or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
name Name of the organization.

Examples

Example 1

The following mongocli iam org list command lists the Ops Manager organizations using the default profile. The profile contains a Programmatic API Key.

mongocli iam org list

The command prints the following fields to the terminal:

{
 "links": [
  {
   "rel": "self",
   "href": "http://example.com:8080/api/public/v1.0/orgs?pageNum=1\u0026itemsPerPage=100"
  }
 ],
 "results": [
  {
   "id": "abcdef3e1234de007b387a9f",
   "links": [
    {
     "rel": "self",
     "href": "http://example.com:8080/api/public/v1.0/orgs/abcdef3e1234de007b387a9f"
    }
   ],
   "name": "Org1"
  }
 ],
 "totalCount": 1
}

Example 2

The following mongocli iam org list command lists all the organizations in an Ops Manager deployment. The command uses the om-personalkey profile, which contains a Personal API Key.

mongocli iam org list -p om-personalkey

The command prints the following fields to the terminal:

{
 "links": [
  {
   "rel": "self",
   "href": "http://www.example.com:8080/api/public/v1.0/orgs?pageNum=1\u0026itemsPerPage=100"
  }
 ],
 "results": [
  {
   "id": "5e332f3e1234de007b387a9f",
   "links": [
    {
     "rel": "self",
     "href": "http://www.example.com:8080/api/public/v1.0/orgs/5e332f3e1234de007b387a9f"
    }
   ],
   "name": "Org1"
  },
  {
   "id": "5e38efd83b60f567896baf4d",
   "links": [
    {
     "rel": "self",
     "href": "http://www.example.com:8080/api/public/v1.0/orgs/5e38efd83b60f567896baf4d"
    }
   ],
   "name": "Org2"
  }
 ],
 "totalCount": 2
}