Use when working with MongoDB — designing a schema or collection (embed vs reference, data modeling, BSON types, schema validation), optimizing performance (indexes, ESR rule, explain() / slow query tuning, aggregation pipelines, covered queries), benchmarking or monitoring (profiler, mongostat, working set, executionStats), or applying standard practices (write/read concern, read preference, transactions, replication, sharding/shard keys, security, connection pooling). Covers MongoDB 8.0 with version-gated notes back to 4.x.
73
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Failed to scan
The risk profile of this skill
Reference guide for MongoDB schema design, performance optimization, benchmarking, and standard practices. Grounded in MongoDB: The Definitive Guide (3rd ed.) and MongoDB 8.0 in Action (Arek Borucki). Use it to give correct, book-backed answers instead of guessing.
mongosh.(≥ to find every version-gated claim.Read only the file(s) the task needs — each is a standalone deep reference.
| Task / symptom | Reference file |
|---|---|
"Should I embed or reference?", data modeling, one-to-many, BSON types, _id/ObjectId, schema validation ($jsonSchema), schema patterns, anti-patterns | references/schema-design.md |
"My query is slow", index design, ESR rule, compound/multikey/text/geo/TTL/partial indexes, reading explain(), covered queries, aggregation pipeline tuning, $lookup | references/performance.md |
"Is this fast enough?", benchmarking method, profiler, mongostat/mongotop, serverStatus, working set / RAM sizing, executionStats metrics, monitoring, alert thresholds | references/benchmarking.md |
| Write/read concern, read preference, transactions, replica sets, sharding & shard-key choice, security/auth/RBAC/TLS/encryption, connection pooling, naming, ops hygiene | references/standard-practices.md |
Cross-cutting rules of thumb live below; the reference files carry the detail, examples, and citations.
Schema
Performance
explain("executionStats") where nReturned ≈ totalKeysExamined ≈ totalDocsExamined. A COLLSCAN or a blocking SORT stage means a missing/wrong index.$or). In aggregation: $match/$sort/$limit early; index the $lookup foreignField; filter before $unwind.Benchmarking
Standard practices
writeConcern:{w:"majority"} for durability (survives failover, no rollback). w:1 can be rolled back. w:"majority" is the 8.0 default (≥5.0).The user asked that this skill track MongoDB version upgrades. When a new major MongoDB release lands (≈yearly):
(≥X.Y). Run grep -rn '(≥' ~/.claude/skills/mongodb-expert/ to list them; check whether defaults/limits changed (e.g. default chunk size, default write concern, ticket behavior).docs.mongodb.com, for the diff.Content is split across the four reference files, so most updates touch one file. Keep citations on version-gated claims — they carry the authority and make the next update greppable.
SKILL.md
4ea83da
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.