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.

MongoDB CLI Configuration File

The MongoDB CLI configuration file stores related settings and API keys in groups called profiles. You can define multiple profiles so that you can use the MongoDB CLI to access different MongoDB services or projects from the same terminal. You can update the settings stored in your configuration file by editing the file with a text editor or by using the mongocli config set command.

Important

Your API keys are like passwords. The configuration file stores API keys in plaintext, so ensure that you secure the configuration file appropriately.

Configuration File Location

The first time you run the mongocli config command, the MongoDB CLI creates a configuration file called mongocli.toml and grants you read and write access to the file. The MongoDB CLI saves the configuration file to the folder where your system stores application configuration files, which is defined by the $XDG_CONFIG_HOME environment variable. By default, this location is the /.config folder of your home directory. If this folder doesn’t exist, the MongoDB CLI creates the folder and grants you read, write, and execute permissions.

Example

The following example configuration file contains two profiles, default and myOpsManager. The default profile contains API keys, an organization ID, and a project ID for an Atlas deployment. The myOpsMgr profile contains API keys, the base URL, an organization ID, and a project ID for an Ops Manager deployment.

[default]
service=cloud
public_api_key=ABCDEFG
private_api_key=e750d2bf-1234-4cde-5678-ca4dcbcac9a4
organization_id=qwer5678uiop23jb45lk78mn
project_id=5e2f04ecf10fcd33c7d4077e

[myOpsMgr]
service=om
public_api_key=HIJKLMN
private_api_key=e750d2bf-9101-4cde-1121-ca4dcbcac9a5
ops_manager_url=http://localhost:9080
organization_id=jklsa23123dsdf3jj456hs2
project_id=kk12jdn43jd123dkdkf97jg