This is a collection of Claude Code plugins :
- MongoDB: build queries in natural language, explore schemas, optimize performance, run migrations, and import/export data.
| Requirement | Details |
|---|---|
| Claude Code | Install Claude Code |
| mongosh | MongoDB Shell — brew install mongosh (macOS) or install guide |
| MONGODB_URI | Connection string as an environment variable |
-
Set your MongoDB connection string
export MONGODB_URI="mongodb+srv://user:pass@cluster.mongodb.net/mydb"
-
Install the plugin
> /plugin marketplace add hoqo/claude-plugins > /plugin install mongodb@hoqo-claude-plugins -
Start using
> /status > /explore > /query users find all active users created this month
/status
- Check connection status and database info.
- Reports connection health, server version, database list with sizes, and current database.
/explore [database-name]
- Quick overview of database.
- Lists all collections with document counts, samples a document from each to reveal the schema, and shows indexes.
- For deep exploration with relationship mapping, use the
db-exploreragent instead.
/query [collection] [query-description]
- Run a query or aggregation pipeline described in natural language.
- Defaults to
find()for simple lookups, uses aggregation for joins and grouping. - Results are automatically limited to 20 documents.
/import [file-path] [collection-name]
- Import data from JSON or CSV files into a collection using
mongoimport. - Confirms before importing into collections that already have data.
/export [collection] [format:json|csv]
- Export collection data to JSON or CSV files using
mongoexport. - Auto-detects fields for CSV exports.
db-explorer
- An autonomous agent that thoroughly documents a database.
- It discovers collections, infers schemas by sampling documents, maps cross-collection relationships via foreign-key-like fields, and generates a structured report with recommendations for missing indexes and schema improvements.
query-advisor
- An interactive query optimizer.
- Give it a slow query and it will: run explain plans, diagnose the root cause (missing index, inefficient pipeline), recommend a fix (compound index, query rewrite), and verify the improvement with before/after metrics.
migration-helper
- Plans and executes MongoDB data migrations safely.
- Supports field renames, type conversions, restructuring (embed to reference), and adding default values.
- All migrations are idempotent, tested on samples first, and use
bulkWritefor performance.
query-builder
Comprehensive reference for queries:
- aggregation pipeline stages
- common operators
$lookupjoins- cursor-based pagination
- full-text search
- transactions
performance-advisor
Index strategy guide covering the ESR rule (Equality, Sort, Range), compound indexes, partial indexes, TTL indexes, explain plan interpretation, and a performance checklist.
schema-analyzer
Schema analysis toolkit: infer field types from sampled documents, detect type inconsistencies, evaluate embedding vs. referencing decisions, recommend JSON Schema validation rules, and flag anti-patterns.
The plugin includes three hooks that run automatically to keep DB safe:
- Connection validation (
SessionStart): Checks thatmongoshis installed andMONGODB_URIis reachable before you start working. - Destructive operation guard (
PreToolUse): Intercepts commands containingdropDatabase,dropCollection,deleteMany({}), ordrop()and asks for explicit confirmation before proceeding. - Error diagnostics (
PostToolUse): When a MongoDB command fails, automatically analyzes the error and suggests a fix.