Skip to content

mongodb-labs/atlas-cli-plugin-sh

Repository files navigation

atlas-cli-plugin-sh

Preview / Release Candidate — This plugin is not yet production-ready. Expect breaking changes. Feedback welcome.

Atlas CLI plugin that launches mongosh connected to an Atlas cluster — no manual connection string needed.

Install

atlas plugin install mongodb-labs/atlas-cli-plugin-sh@v1.0.0-rc4

Usage

Interactive shell

Usage

atlas sh --cluster <cluster-name> [--project-id <project-id>] [--profile <profile>]

Example

❯ atlas sh --cluster MyCluster
Current Mongosh Log ID:    683a1fc72d4e890b12cd4a77
Connecting to:        mongodb+srv://<credentials>@mycluster.rx4kpqz.mongodb.net/?authSource=admin&appName=mongosh+2.7.0
Using MongoDB:        8.0.23
Using Mongosh:        2.7.0

Atlas mycluster-shard-0 [primary] test>

Run a single command

Usage

atlas sh --cluster <cluster-name> --eval "<mongosh expression>"

Example

❯ atlas sh --cluster MyCluster --eval "show dbs"
admin  0 B
local  0 B

Pass mongosh arguments

Any flags not recognized by atlas sh are forwarded verbatim to mongosh.

atlas sh --cluster MyCluster --quiet --norc

Requirements

How it works

The plugin fetches connection credentials from Atlas via the Atlas CLI, stores them securely in the system keychain, then invokes mongosh with the appropriate connection string. On exit, credentials are removed from the keychain.

About

[preview] Atlas CLI plugin that launches mongosh connected to an Atlas cluster — no manual connection string needed.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages