https://github.com/mongodb/mongodb-cli
MongoDB CLI enable you to manage your MongoDB via ops manager and cloud manager
https://github.com/mongodb/mongodb-cli
Last synced: about 1 month ago
JSON representation
MongoDB CLI enable you to manage your MongoDB via ops manager and cloud manager
- Host: GitHub
- URL: https://github.com/mongodb/mongodb-cli
- Owner: mongodb
- License: apache-2.0
- Created: 2025-01-21T11:54:51.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-04-11T15:25:17.000Z (about 1 month ago)
- Last Synced: 2025-04-11T16:43:39.516Z (about 1 month ago)
- Language: Go
- Size: 22.1 MB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# MongoDB CLI

The MongoDB CLI is a modern command line interface that enables you to manage your MongoDB services from the terminal.

Use simple, one-line commands to interact with Ops Manager or Cloud Manager, and automate management tasks for your deployments.
## Documentation
See the [official docs](https://docs.mongodb.com/mongocli/stable/) for instructions on how to
install, set up, and reference available commands.## Installing
### Homebrew on macOS
```bash
brew install mongocli
```### Pre-built Binaries
Download the appropriate version for your platform from [mongocli releases](https://github.com/mongodb/mongodb-cli/releases).
After you download the library, you can run it from anywhere and don't need to install it into a global location.
This works well for shared hosts and other systems where you don't have a privileged account.You can place this binary somewhere in your `PATH` for ease of use.
`/usr/local/bin` is the most probable location.### Build From Source
#### Fetch Source
```bash
git clone https://github.com/mongodb/mongodb-cli.git
cd mongodb-cli
```#### Build
To build `mongocli`, run:
```bash
make build
```The resulting `mongocli` binary is placed in `./bin`.
#### Install
To install the `mongocli` binary in `$GOPATH/bin`, run:
```bash
make install
```**Note:** running `make build` is not needed when running `make install`.
## Usage
To get a list of available commands, run `mongocli help`
or check our [documentation](https://docs.mongodb.com/mongocli/master/) for more details.### Configuring MongoCLI with Ops Manager and Cloud Manager
#### Getting API Keys (Ops manager / Cloud Manager)
To use `mongocli`, create API keys. To learn more, see the documentation for the service you're using:
- [Ops Manager](https://docs.opsmanager.mongodb.com/current/tutorial/configure-public-api-access/),
- [Cloud Manager](https://docs.cloudmanager.mongodb.com/tutorial/manage-programmatic-api-keys/)#### Set up your credentials
To set up your credentials, run `mongocli config`, or use [env variables](https://docs.mongodb.com/mongocli/stable/configure/environment-variables/) instead.If you're working with Ops Manager or Cloud Manager you need to define the service using `--service`
- For Ops Manager, `mongocli config --service ops-manager`
- For Cloud Manager, `mongocli config --service cloud-manager`### Shell Completions
If you install via [homebrew](#hombrew-on-macos) no additional actions are needed.
To get specific instructions for your preferred shell, run:
```bash
mongocli completion --help
```## Contributing
See our [CONTRIBUTING.md](CONTRIBUTING.md) guide.
## License
MongoDB CLI is released under the Apache 2.0 license. See [LICENSE](LICENSE)