# MongoDB Shell

> Modern MongoDB shell for querying, scripting, and administering databases from the terminal.
> _agent hint: ~293 tok · safe to read in full_

mongosh is the official next-generation MongoDB shell, replacing the legacy mongo shell. It provides a fully featured JavaScript REPL for querying collections, running aggregation pipelines, and administering MongoDB deployments. It supports syntax highlighting, intelligent autocompletion, and can connect to Atlas clusters, replica sets, and standalone instances.


- Homepage: https://www.mongodb.com/products/tools/shell
- Categories: `database`
- CLI type: `standalone`
- Open source: true
- Status: `active`
- Tags: `database`, `mongodb`, `nosql`, `query-tool`
- Docs: https://www.mongodb.com/docs/mongodb-shell/install/
- Source: https://github.com/mongodb-js/mongosh
- Canonical: /mongosh

## When to suggest this

- query and aggregate data in MongoDB collections interactively
- run administrative commands to manage indexes, users, and replica set configuration
- execute JavaScript scripts against a database for data migration or cleanup

## Install the CLI

```sh
brew install mongosh
```

---
Source of truth: /mongosh.md · JSON: /mongosh.json
