MongoDB taste — ChatGPT prompt: what it does, how to install
MongoDB taste is a ChatGPT prompt for MongoDB document design around query patterns, indexes, and schema checks. Claude Code loads it from a command file.
CC0-1.0 ★ 178,201 updated 2026-10-24
Open on GitHubWhat MongoDB taste does
MongoDB taste sets a query-led way to design MongoDB collections. It guides decisions about embedded versus referenced data, bounded arrays, $jsonSchema validators, date and money types, schema versions, and TTL indexes.
Its database rules cover compound indexes, projections, range pagination, and query inspection with explain("executionStats"). It favors atomic operators such as $inc, $set, and $push with $slice, while aggregation pipelines should place $match and $project early. Multi-document transactions are reserved for models that truly require them.
Production guidance includes one shared client with a tuned pool, authentication, TLS, least-privilege roles, and no public exposure of port 27017. Local development and tests use real MongoDB in a container or replica set instead of an in-memory fake. In Claude Code, the file path is .claude/commands/prompts.csv.md.
What it helps with
- design MongoDB collections around read patterns
- choose between embedded and referenced documents
- detect COLLSCAN and slow query paths
- set up validators, indexes, and TTL expiry
- tighten MongoDB access and backup restore checks
Example prompts for the agent
- Design MongoDB collections around these read patterns and decide what should be embedded or referenced.
- Inspect this MongoDB query, propose a compound index using equality, sort, and range, and add a projection.
- Write production MongoDB rules covering
$jsonSchema, TTL indexes,w: "majority", TLS, and least-privilege roles.
How to install MongoDB taste
How to use
Paste the text at the start of a chat or into project instructions
Manually: put the files in place
.claude/commands/prompts.csv.mdQuestions about MongoDB taste
How do I install MongoDB taste in Claude Code?
Place the file at .claude/commands/prompts.csv.md.
What does MongoDB taste do?
It provides rules for query-shaped MongoDB models, embedded and referenced data, validators, indexes, pagination, atomic updates, aggregation, and access controls.
What does MongoDB taste require for local development?
Local development and tests should run against real MongoDB in a container or replica set. An in-memory fake is not used.
Source text
prompts.csv · CC0-1.0
# MongoDB taste of a backend engineer who models documents around queries
- Design each collection around the application's read patterns first, then decide what to embed and what to reference. Confidence: 0.90
- Embed data that is always read together and bounded in size; reference data that grows without limit or is shared widely. Confidence: 0.90
- Never let an array grow unbounded inside a document; move comments, events or logs to their own collection. Confidence: 0.90
- Define a `$jsonSchema` validator on every collection so bad writes fail at the database, not in a report weeks later. Confidence: 0.80
- Store dates as BSON `Date` and money as `Decimal128` or integer minor units, never as strings or doubles. Confidence: 0.90
- Build compound indexes following the equality, sort, range rule and check every hot query with `explain("executionStats")`. Confidence: 0.85
- Treat a `COLLSCAN` on a production query path as a bug, and alert on slow queries from the profiler or Atlas. Confidence: 0.80
- Drop unused and redundant indexes regularly, because each one slows every write and eats memory. Confidence: 0.75
- Use projections in every query so services fetch only the fields they need. Confidence: 0.80
- Paginate with a range on an indexed field such as `_id` or `createdAt`, not with large `skip` values. Confidence: 0.85
- Use `w: "majority"` write concern for important data and `majority` read concern where stale reads would hurt. Confidence: 0.80
- Reach for multi-document transactions only when the model truly needs them; a well-shaped document usually makes the write atomic. Confidence: 0.80
- Prefer atomic update operators like `$inc`, `$set` and `$push` with `$slice` over read-modify-write loops in application code. Confidence: 0.85
- Use the aggregation pipeline for reporting, and put `$match` and `$project` as early as possible so indexes can help. Confidence: 0.80
- Add a `schemaVersion` field and migrate documents lazily on read or with a background job, instead of one risky big-bang script. Confidence: 0.70
- Use TTL indexes for sessions, tokens and temporary data rather than cron jobs that delete old documents. Confidence: 0.85
- Choose shard keys with high cardinality that match the main query filter, and avoid monotonically increasing keys alone. Confidence: 0.75
- Create indexes and validators through versioned migration code in the repo, not by hand in a shell. Confidence: 0.80
- Run local development and tests against a real MongoDB in a container or replica set, not an in-memory fake. Confidence: 0.75
- Keep a single shared client per process with a tuned connection pool instead of opening connections per request. Confidence: 0.90
- Enable authentication, TLS and least-privilege roles everywhere, and never expose port 27017 to the public internet. Confidence: 0.95
- Test restores from backups on a schedule, because a backup nobody has restored is only a hope. Confidence: 0.85
© f · CC0-1.0 · f/prompts.chat