Docs Menu
Docs Home
/ /
MongoDB Command Line Interface
/ / /

mongocli iam project create

On this page

  • Syntax
  • Options
  • Output
  • Examples

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.

mongocli iam project create <project-name>
--orgId <organization-ID>
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]

Note

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

Option
Type
Description
Required?
--orgId
string
Unique identifier of the organization that contains the new project.
yes
--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 Go template file

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

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.

Field
Description
agentApiKey
Agent API key for the project. Ops Manager only.
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
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

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

The previous command prints the following in the specified 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"
}
]
}

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

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

{
"agentApiKey": "7f36b2fbc702201990297cff5bbcc5688b98199a43467d421f05c6cb",
"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
}

Back

Projects