mongocli config set
The config set
command sets the following
properties in the specified profile for MongoDB CLI:
Property | Description |
---|---|
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 only. Ops Manager base URL. The URL must end with a
forward slash (i.e. / ). |
ops_manager_ca_certificate | Ops Manager only. If applicable, the full path on your local
system to the PEM-encoded Certificate Authority (CA) certificate
used to sign the client and Ops Manager TLS certificates. |
ops_manager_skip_verify | Ops Manager only. When set to ImportantSetting |
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:
| yes | ||||||||||||||||
<value> | string | The value for the property to set. Value must be:
| 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
ops_manager_ca_certificate
ops_manager_skip_verify
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'
Set Custom CA Certificate File
The following example uses the mongocli config set
command to
set a custom CA certificate file for Ops Manager in a profile named
egOMprofile
.
mongocli config set ops_manager_ca_certificate /etc/ssl/certs/ca.pem -p egOMprofile
The previous command prints the following to the terminal:
Updated property 'ops_manager_ca_certificate'
Set Certificate Verification
The following example uses the mongocli config set
command to
skip TLS certificate verification for Ops Manager in a profile named
egOMprofile
.
Important
Setting ops_manager_skip_verify
to yes
is insecure and is not
recommended in production environments.
mongocli config set ops_manager_skip_verify yes -p egOMprofile
The previous command prints the following to the terminal:
Updated property 'ops_manager_skip_verify'