Docs Home → MongoDB Command Line Interface
mongocli config
On this page
Description
The config
command configures the MongoDB CLI to access MongoDB
services, including MongoDB Atlas, MongoDB Cloud Manager, and MongoDB Ops Manager. The
command groups the settings for accessing the service into a
profile.
When you run the command, it prompts you for the following information:
Setting | Description | Necessity |
---|---|---|
Ops Manager Base URL | URL to access your Ops Manager instance. | Required for Ops Manager access. |
Public API Key Private API Key | Public and Private API key for programmatic access to your project using the MongoDB CLI. For more information on generating these keys, see: | Required. |
Default Org ID | ID of your organization. | Optional. |
Default Project ID | ID of your project. | Optional. |
MongoDB CLI saves these settings as a profile in the MongoDB CLI Configuration File.
Syntax
mongocli config [ --profile|-P <profile-name> ] [ --service cloud|cloud-manager|ops-manager ]
Note
Use -h
or --help
to view the command-line help for
this command.
Options
Option | Type | Description | Required? |
---|---|---|---|
--profile , -P | string | Name for the profile where the access information is saved.
If this is omitted, MongoDB CLI saves the access information in a
profile named default . | no |
--service | string | MongoDB service for which you are configuring MongoDB CLI access. Value can be:
If this is omitted, defaults to | no |
Output
The command does not print any output to the terminal. To verify that
the command was successful, you can look for the profile in the
mongocli.toml
file or use mongocli config describe. If
the command returns errors, see Troubleshooting
for recommended solutions.
Examples
The following examples use the mongocli config
command to:
Create a profile for accessing a service.
Save the access information for the service under that profile.