Skip to content

A modern Rust-based MongoDB shell delivering faster startup, safer commands, and a clean, developer-friendly CLI experience.

License

Notifications You must be signed in to change notification settings

daleione/mongosh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rust MongoDB Power CLI

Crates.io Rust License: MIT

A power-user oriented MongoDB CLI written in Rust, focused on productivity, scripting, and rich output.

Note: This project is an independent, community-driven tool. It is NOT affiliated with MongoDB, and it is not intended to be a drop-in replacement for the official mongosh.


✨ Why Another MongoDB CLI?

The official MongoDB Shell (mongosh) is excellent for compatibility and JavaScript workflows. This project exists for engineers who want a faster, more scriptable, and CLI-native experience:

  • 🧠 Power-user workflows β€” Batch queries, automation, CI/CD
  • πŸ“Š Readable output β€” Tables, highlighted JSON
  • ⚑ Fast startup & execution β€” Compiled Rust binary
  • 🧩 Extensible architecture β€” Plugins & future extensions

If you rely heavily on JavaScript execution inside the shell, you should continue using the official mongosh.


πŸ” Key Differences vs Official mongosh

Feature Official mongosh This Project
Implementation Node.js Rust (async)
JS Runtime Full JavaScript ❌ Not a JS shell
Startup Time Slower Fast
Output JSON-first Tables + highlighted JSON
Scripting JS-based CLI / batch-oriented
Target Users General users Power users / DevOps

🚧 Project Status

⚠️ Active Development – Not Production Ready

  • APIs and commands may change
  • Some MongoDB features are incomplete
  • Bugs and panics may exist

Feedback, testing, and contributions are highly welcome.


✨ Features

  • ⚑ High Performance β€” Native Rust, async I/O
  • πŸ’Ύ Lightweight β€” Small static binary
  • πŸ”’ Type Safety β€” Memory-safe by design
  • 🧡 Async Execution β€” Powered by Tokio
  • 🎨 Syntax Highlighting β€” Readable command & JSON output
  • 🧠 Smart Completion β€” Context-aware auto-completion
  • πŸ“Š Rich Output β€” Table & structured views (WIP)
  • πŸ”Œ Extensible β€” Plugin-friendly design
  • 🌍 Cross-Platform β€” Linux, macOS, Windows

πŸ“¦ Installation

cargo install mongosh

Note: The binary name may change in the future to avoid conflicts with the official MongoDB shell.


πŸš€ Quick Start

Connect to MongoDB

# Connect to local MongoDB
mongosh

# Connect to a specific host
mongosh mongodb://localhost:27017

# Connect with authentication
mongosh mongodb://username:password@localhost:27017/dbname

πŸ§ͺ Example Commands

Show Databases

show dbs

Switch Database

use mydb

Show Collections

show collections

Insert a Document

db.users.insertOne({ name: "John Doe", age: 25 });

Query Documents

db.users.find({ age: { $gte: 18 } });

Update Documents

db.users.updateOne({ name: "John Doe" }, { $set: { age: 26 } });

Aggregation Pipeline

db.orders.aggregate([
  { $match: { status: "completed" } },
  { $group: { _id: "$userId", total: { $sum: "$amount" } } },
]);

πŸ“„ License

Licensed under the MIT License.


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“¬ Feedback

If you have any questions, suggestions, or issues, please open an issue on GitHub.

About

A modern Rust-based MongoDB shell delivering faster startup, safer commands, and a clean, developer-friendly CLI experience.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages