Navigation

mongocli iam project create

On this page

The mongocli iam project create command creates a project in the specified organization using the specified profile.

You must have the Organization Project Creator role to run this command.

Syntax

mongocli iam project create <project-name>
     --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 new project. yes
--profile, -P string Name of the profile that contains the access information. If omitted, uses the default profile. no

Output

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

Field Description
hostcounts Number of primary, secondary, slave, arbiter, config, master, and mongos nodes in the cluster in the project.
id Unique identifier of the project.
created Timestamp when the project was created, in ISO 8601 date and time in UTC format.
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:

  • true if enabled
  • false if disabled

Examples

Example 1

The following command creates a project called myProject in an Atlas organization. It uses the default profile for accessing Atlas.

mongocli iam project create myProject --orgId 5df27c15f10fab55fc6c1234

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

{
 "id": "5e44445ef10fab20b49c0f31",
 "orgId": "5df27c15f10fab55fc6c1234",
 "name": "myProject",
 "created": "2020-01-30T22:10:39Z",
 "links": [
  {
   "rel": "self",
   "href": "https://example.com/api/atlas/v1.0/groups/5e33545ef10fab20b49c0f31"
  },
  {
   "rel": "http://mms.mongodb.com/containers",
   "href": "https://example.com/api/atlas/v1.0/groups/5e33545ef10fab20b49c0f31/containers"
  },
  {
   "rel": "http://mms.mongodb.com/clusters",
   "href": "https://example.com/api/atlas/v1.0/groups/5e33545ef10fab20b49c0f31/clusters"
  },
  {
   "rel": "http://mms.mongodb.com/databaseUsers",
   "href": "https://example.com/api/atlas/v1.0/groups/5e33545ef10fab20b49c0f31/databaseUsers"
  },
  {
   "rel": "http://mms.mongodb.com/peers",
   "href": "https://example.com/api/atlas/v1.0/groups/5e33545ef10fab20b49c0f31/peers"
  },
  {
   "rel": "http://mms.mongodb.com/processes",
   "href": "https://example.com/api/atlas/v1.0/groups/5e33545ef10fab20b49c0f31/processes"
  },
  {
   "rel": "http://mms.mongodb.com/whitelist",
   "href": "https://example.com/api/atlas/v1.0/groups/5e33545ef10fab20b49c0f31/whitelist"
  }
 ]
}

Example 2

The following command creates a project called myProject in an Ops Manager organization. It uses the profile named myOM for accessing Ops Manager.

mongocli iam project create myProject --orgId 5e332f3e2456de007b385678 --profile myOM

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

{
 "hostCounts": {
  "arbiter": 0,
  "config": 0,
  "master": 0,
  "mongos": 0,
  "primary": 0,
  "secondary": 0,
  "slave": 0
 },
 "id": "5e33b9412456de007b38bxyz",
 "links": [
  {
   "rel": "self",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e"
  },
  {
   "rel": "http://mms.mongodb.com/hosts",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e/hosts"
  },
  {
   "rel": "http://mms.mongodb.com/users",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e/users"
  },
  {
   "rel": "http://mms.mongodb.com/clusters",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e/clusters"
  },
  {
   "rel": "http://mms.mongodb.com/alertConfigs",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e/alertConfigs"
  },
  {
   "rel": "http://mms.mongodb.com/alerts",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e/alerts"
  },
  {
   "rel": "http://mms.mongodb.com/backupConfigs",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e/backupConfigs"
  },
  {
   "rel": "http://mms.mongodb.com/agents",
   "href": "http://example.com:8080/api/public/v1.0/groups/5e33b9412456de007b38bc1e/agents"
  }
 ],
 "name": "myProject",
 "orgId": "5e332f3e2456de007b385678",
 "publicApiEnabled": true
}