Docs Menu

Docs HomeMongoDB Command Line Interface

mongocli config

On this page

  • Description
  • Syntax
  • Options
  • Examples

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.

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.

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:

  • cloud - for Atlas

  • cloud-manager - for Cloud Manager

  • ops-manager - for Ops Manager

If this is omitted, defaults to cloud for Atlas.

no

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.

The following examples use the mongocli config command to:

  1. Create a profile for accessing a service.

  2. Save the access information for the service under that profile.

←  mongocli Configuration Commandsmongocli config set →
Share Feedback