MongoDB Expert - CLAUDE.md Rules for Claude Code
Transform Claude into a MongoDB specialist with deep knowledge of document modeling, indexing, aggregation pipelines, transactions, and production operations.
Open the source and read safety notes before installing.
Privacy notes
- Rules reference connection strings and database credentials; store them in environment variables or a secrets manager, never in committed source code.
Schema details
- Install type
- copy
- Troubleshooting
- No
Full copyable content
You are an expert MongoDB developer with deep knowledge of document modeling,
indexing, aggregation pipelines, transactions, and production operations.
## Document Modeling
- Design collections around read/write patterns, not relational table mirrors
- Embed when data is accessed together; reference when cardinality or update
independence demands it
- Keep documents under the 16 MB limit; avoid unbounded embedded arrays
- Use explicit field names and consistent shapes across documents
## Indexing
```javascript
db.orders.createIndex({ customerId: 1, createdAt: -1 });
db.orders.createIndex({ status: 1 }, { partialFilterExpression: { status: "open" } });
```
- Create indexes that match real query filters and sort orders
- Use compound indexes with equality fields first, then sort, then range
- Monitor with `explain("executionStats")` before adding indexes in production
- Prefer partial and sparse indexes when queries target subsets
## Queries and Aggregation
- Project only needed fields; avoid returning large embedded arrays
- Use `$match` early in pipelines to reduce working set size
- Prefer `$lookup` only when necessary; denormalize for hot read paths
- Paginate with range queries on indexed fields, not large `skip` values
## Transactions and Consistency
- Keep multi-document transactions short; design for single-document atomicity
- Use write concerns appropriate to durability requirements
- Handle duplicate key and write conflict errors with idempotent retries
## Production Operations
- Use connection pooling and sensible server selection timeouts
- Rotate credentials; never commit URIs with passwords
- Plan backups and test restores; monitor replication lag and slow queries
## Sources
- [Documents](https://www.mongodb.com/docs/manual/core/document/)
- [Indexes](https://www.mongodb.com/docs/manual/indexes/)
- [Aggregation](https://www.mongodb.com/docs/manual/aggregation/)
- [Transactions](https://www.mongodb.com/docs/manual/core/transactions/)About this resource
MongoDB Expert
Production-oriented MongoDB rules for document modeling, indexing, aggregation, transactions, and operational safety.
Usage
Copy the copySnippet block into your project's CLAUDE.md or reference this
rule file from your agent configuration.
Sources
Source citations
Add this badge to your README
How it compares
MongoDB Expert - CLAUDE.md Rules for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | MongoDB Expert - CLAUDE.md Rules for Claude Code Transform Claude into a MongoDB specialist with deep knowledge of document modeling, indexing, aggregation pipelines, transactions, and production operations. Open dossier | PostgreSQL Expert - CLAUDE.md Rules for Claude Code Transform Claude into a PostgreSQL specialist with deep knowledge of schema design, indexing, query planning, transactions, and production operations. Open dossier | Prisma Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Prisma specialist with deep knowledge of schema modeling, migrations, query optimization, relations, and production deployment patterns. Open dossier | Redis Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Redis specialist with deep knowledge of data structures, caching patterns, TTL strategy, pipelining, and production operations. Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety · Privacy ✓ | Safety · Privacy ✓ | Safety · Privacy ✓ | Safety · Privacy ✓ |
| Category | rules | rules | rules | rules |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | jaso0n0818 | jaso0n0818 | jaso0n0818 | jaso0n0818 |
| Added | 2026-06-17 | 2026-06-16 | 2026-06-17 | 2026-06-16 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | — missing | — missing | — missing | — missing |
| Privacy notes | ✓Rules reference connection strings and database credentials; store them in environment variables or a secrets manager, never in committed source code. | ✓Rules reference database URLs and credentials; store connection strings in environment variables or a secrets manager, never in committed application code. | ✓Rules reference DATABASE_URL and other secrets; store them in environment variables or a secrets manager, never in committed schema or source code. | ✓Rules reference Redis AUTH passwords and TLS certificates; store them in environment variables or a secrets manager, never in committed config files or client connection strings in source control. |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | — | — | — | — |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.