Navigation

mongocli iam organization list

The mongocli iam organization list command lists organizations in your Ops Manager instance.

To list all organizations in your Ops Manager, your profile must use a Global API key pair or a Personal API key.

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

You can also list organizations through the API.

mongocli iam organization|organizations|org|orgs list|ls
[ --includeDeleted ]
[ --limit <number-of-orgs> ]
[ --name <org-name> ]
[ --output|-o <output-format> ]
[ --page <number-of-pages> ]
[ --profile|-P <profile-name> ]
Note

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

Option
Type
Description
Required?
--includeDeleted

Flag that indicates whether MongoDB CLI returns deleted organizations.

Important

This flag:

  • is applicable for Ops Manager organizations only. MongoDB CLI never returns deleted Atlas or Cloud Manager organizations.
  • requires you to have an Ops Manager global role.

If omitted, MongoDB CLI doesn't return deleted organizations.

no
--limit
integer

Number of organizations to return per page.

  • If this value exceeds the number of organizations, mongocli returns all organizations. Maximum value is 500.
  • If omitted, defaults to 100.

For example usage, see List the Sixth through Tenth Organizations.

no
--name
string

Filter that MongoDB CLI uses to limit results based on the specified organization name. Performs a case-insensitive search for organizations that exactly match the specified name.

Example

If you specify a --name option of org1, MongoDB CLI returns organizations named org1 and Org1, but would not return an organization named org123.

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 the Go template file

If omitted, the command returns output in the default format.

no
--page
integer

Page number (1-based) to return from the result set.

  • The --limit flag sets the number of organizations per page.
  • If omitted, returns the first page.

For example usage, see List the Sixth through Tenth Organizations.

no
--profile, -P
string

Name of the profile where your credentials are saved.

If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.

no

The command prints 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 URL s 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.

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 URL s are explained in the Web Linking Specification.
name
Name of the organization.

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 --output json

The command returns the following JSON document:

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

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 --output json -P om-personalkey

The command returns the following JSON document:

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

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

mongocli iam org list -P om-personalkey --limit 5 --page 2 --output json

This command returns the following list in the specified format to the terminal. To learn more about these fields, see Output.

{
"links": [
{
"rel": "self",
"href": "http://www.example.com:8080/api/public/v1.0/orgs?pageNum=1\u0026itemsPerPage=5"
}
],
"results": [
{
"id": "5e332f3e1234de007b387a9f",
"isDeleted": false,
"links": [
{
"rel": "self",
"href": "http://www.example.com:8080/api/public/v1.0/orgs/5e332f3e1234de007b387a9f"
}
],
"name": "Org6"
},
{
"id": "5e38efd83b60f567896baf4d",
"isDeleted": false,
"links": [
{
"rel": "self",
"href": "http://www.example.com:8080/api/public/v1.0/orgs/5e38efd83b60f567896baf4d"
}
],
"name": "Org7"
},
{
"id": "27a91237ba9cb28a15ed3f51",
"isDeleted": false,
"links": [
{
"rel": "self",
"href": "http://www.example.com:8080/api/public/v1.0/orgs/27a91237ba9cb28a15ed3f51"
}
],
"name": "Org8"
},
{
"id": "959bd41f6c65d5a31077f78a",
"isDeleted": false,
"links": [
{
"rel": "self",
"href": "http://www.example.com:8080/api/public/v1.0/orgs/959bd41f6c65d5a31077f78a"
}
],
"name": "Org9"
},
{
"id": "f459b51a9a6e4eba907b47ad",
"isDeleted": false,
"links": [
{
"rel": "self",
"href": "http://www.example.com:8080/api/public/v1.0/orgs/f459b51a9a6e4eba907b47ad"
}
],
"name": "Org10"
}
],
"totalCount": 20
}
Give Feedback