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 config set

On this page

The config set command sets the following properties in the specified profile for MongoDB CLI:

  • org_id - Unique identifier of an organization
  • project_id - Unique identifier of a project
  • public_api_key - Public key for programmatic access
  • private_api_key - Private key for programmatic access
  • ops_manager_url - Ops Manager base URL for Ops Manager only

You can set also set these properties by directly editing the MongoDB CLI Configuration File or by setting the environment variables.

Syntax

mongocli config set ( <property-name> <value> )
     --profile|-p <profile-name>

Note

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

Options

Option Type Description Required?
--profile, -p string Name of the profile where you wish to set the property. If omitted, uses the default profile. no
<property-name> string

Property to set in the profile. Value can be one of the following:

  • org_id - Unique identifier of the organization
  • project_id - Unique identifier of the project
  • public_api_key - Public key for programmatic access
  • private_api_key - Private key for programmatic access
  • ops_manager_url - Ops Manager base URL for Ops Manager only
yes
<value> string

The value for the property to set. Value must be:

  • Unique identifier of the organization for org_id
  • Unique identifier of the project for project_id
  • Public API key for public_api_key
  • Private API key for private_api_key
  • Ops Manager base URL for ops_manager_url
yes

Output

The command output looks similar to the following if the command succeeds. If the command prints errors, see Troubleshooting for recommended solutions.

Updated prop '<property-name>'

where <property-name> can be:

  • org_id
  • project_id
  • public_api_key
  • private_api_key
  • ops_manager_url

Examples

The following examples use the mongocli config set command to set different properties.

Set Ops Manager URL

The following example uses the mongocli config set command to set the Ops Manager base URL in a profile named egOMprofile.

~ mongocli config set ops_manager_url http://localhost:30700 -p egOMprofile

The previous command prints the following to the terminal:

Updated prop 'ops_manager_url'

Set Organization ID

The following example uses the mongocli config set command to set the organization ID for Atlas in the default profile.

~ mongocli config set org_id 5dd5aaef7a3e5a6c5bd12de4

The previous command prints the following to the terminal:

Updated prop 'org_id'

Set Project ID

The following example uses the mongocli config set command to set the project ID for Cloud Manager in the default profile.

~ mongocli config set project_id 5e2f06127a3e5a5700de8d8d

The previous command prints the following to the terminal:

Updated prop 'project_id'

Set Public Key

The following example uses the mongocli config set command to set the public API key for an Atlas project in a profile named atlasProfile.

~ mongocli config set public_api_key abcdefgh -p atlasProfile

The previous command prints the following to the terminal:

Updated prop 'public_api_key'

Set Private Key

The following example uses the mongocli config set command to set the private API key for an Atlas project in a profile named atlasProfile.

~ mongocli config set private_api_key 12a34bc5-6789-1de2-f345-g67hijkl89m1 -p atlasProfile

The previous command prints the following to the terminal:

Updated prop 'private_api_key'