[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-mongodb-mongodb-schema-design":3,"mdc-9z384d-key":40,"related-repo-mongodb-mongodb-schema-design":1245,"related-org-mongodb-mongodb-schema-design":1335},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":35,"sourceUrl":38,"mdContent":39},"mongodb-schema-design","design and optimize MongoDB schemas","MongoDB schema design patterns and anti-patterns. Use when designing data models, reviewing schemas, migrating from SQL, or troubleshooting performance issues caused by schema problems. Triggers on \"design schema\", \"embed vs reference\", \"MongoDB data model\", \"schema review\", \"unbounded arrays\", \"one-to-many\", \"tree structure\", \"16MB limit\", \"schema validation\", \"JSON Schema\", \"time series\", \"schema migration\", \"polymorphic\", \"TTL\", \"data lifecycle\", \"archive\", \"index explosion\", \"unnecessary indexes\", \"approximation pattern\", \"document versioning\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"mongodb","MongoDB","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fmongodb.jpg",[12,16,17,20],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":9,"slug":8,"type":15},{"name":18,"slug":19,"type":15},"Database","database",{"name":21,"slug":22,"type":15},"Data Modeling","data-modeling",155,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002Fagent-skills","2026-07-16T06:00:24.782785","Apache-2.0",28,[29,30,31,32,33,34],"agent","claude","cursor","gemini-cli-extension","mcp","skills",{"repoUrl":24,"stars":23,"forks":27,"topics":36,"description":37},[29,30,31,32,33,34],"Use the official MongoDB Skills with your favorite coding agent to build faster.","https:\u002F\u002Fgithub.com\u002Fmongodb\u002Fagent-skills\u002Ftree\u002FHEAD\u002Fskills\u002Fmongodb-schema-design","---\nname: mongodb-schema-design\ndescription: MongoDB schema design patterns and anti-patterns. Use when designing data models, reviewing schemas, migrating from SQL, or troubleshooting performance issues caused by schema problems. Triggers on \"design schema\", \"embed vs reference\", \"MongoDB data model\", \"schema review\", \"unbounded arrays\", \"one-to-many\", \"tree structure\", \"16MB limit\", \"schema validation\", \"JSON Schema\", \"time series\", \"schema migration\", \"polymorphic\", \"TTL\", \"data lifecycle\", \"archive\", \"index explosion\", \"unnecessary indexes\", \"approximation pattern\", \"document versioning\".\nlicense: Apache-2.0\nmetadata:\n  version: \"1.0.0\"\n---\n\n# MongoDB Schema Design\n\nData modeling patterns and anti-patterns for MongoDB, maintained by MongoDB. Bad schema is the root cause of most MongoDB performance and cost issues—queries and indexes cannot fix a fundamentally wrong model.\n\n## When to Apply\n\nReference these guidelines when:\n- Designing a new MongoDB schema from scratch\n- Migrating from SQL\u002Frelational databases to MongoDB\n- Reviewing existing data models for performance issues\n- Troubleshooting slow queries or growing document sizes\n- Deciding between embedding and referencing\n- Modeling relationships (one-to-one, one-to-many, many-to-many)\n- Implementing tree\u002Fhierarchical structures\n- Seeing Atlas Schema Suggestions or Performance Advisor warnings\n- Hitting the 16MB document limit\n- Adding schema validation to existing collections\n\n## Quick Reference\n\n### 1. Schema Anti-Patterns - 3 rules\n\n- [antipattern-unnecessary-collections](references\u002Fantipattern-unnecessary-collections.md) - Splitting homogeneous data into multiple collections is often an anti-pattern; consult this reference to validate whether this is the case.\n- [antipattern-excessive-lookups](references\u002Fantipattern-excessive-lookups.md) - When encountering overly normalized collections that reference each other or frequent and possibly slow $lookup operations, consult this reference to validate whether this is problematic and how to fix it.\n- [antipattern-unnecessary-indexes](references\u002Fantipattern-unnecessary-indexes.md) - Consult this reference when indexes overlap or are not used by queries, to identify and remove unnecessary indexes that add overhead without benefit.\n\n### 2. Schema Fundamentals - 4 rules\n\n- [fundamental-embed-vs-reference](references\u002Ffundamental-embed-vs-reference.md) - Consult this reference for approaches to modeling different types of relationships (1:1, 1:few, 1:many, many:many, tree\u002Fhierarchical data) and how to decide between embedding and referencing based on access patterns.\n- [fundamental-document-model](references\u002Ffundamental-document-model.md) - Fundamentals of the document model. Consult this reference when migrating from SQL or other normalized data to a document database like MongoDB.\n- [fundamental-schema-validation](references\u002Ffundamental-schema-validation.md) - Consult this reference when creating new collections, or adding validation to existing collections, for example in response to finding inconsistent document structures or data quality issues.\n- [fundamental-document-size](references\u002Ffundamental-document-size.md) - Consult this reference when documents hit the hard 16MB limit, or when accesses are slower than expected as a result of large documents.\n\n### 3. Design Patterns - 11 rules\n\n- [pattern-approximation](references\u002Fpattern-approximation.md) - Use approximate values for high-frequency counters\n- [pattern-archive](references\u002Fpattern-archive.md) - Move historical data to separate\u002Fcold storage for performance\n- [pattern-attribute](references\u002Fpattern-attribute.md) - Collapse many optional fields into key-value attributes\n- [pattern-bucket](references\u002Fpattern-bucket.md) - Group time-series or IoT data into buckets\n- [pattern-computed](references\u002Fpattern-computed.md) - Pre-calculate expensive aggregations\n- [pattern-document-versioning](references\u002Fpattern-document-versioning.md) - Track document changes to enable historical queries and audit trails\n- [pattern-extended-reference](references\u002Fpattern-extended-reference.md) - Cache frequently-accessed data from related entities\n- [pattern-outlier](references\u002Fpattern-outlier.md) - Handle collections in which a small subset of documents are much larger than the rest, to prevent outliers from dominating memory and index costs\n- [pattern-polymorphic](references\u002Fpattern-polymorphic.md) - Store different types of entities in the same collection, often when they are different types of the same base entity (e.g. different types of users or different types of products)\n- [pattern-schema-versioning](references\u002Fpattern-schema-versioning.md) - Schema evolution, preventing drift, and safe online migrations. Consult when encountering inconsistent document structures, or when planning a schema change that cannot be applied atomically.\n- [pattern-time-series-collections](references\u002Fpattern-time-series-collections.md) - Use native time series collections for high-frequency time series data\n\n### Access Pattern Analysis\n\nDo not immediately recommend a pattern or schema change without understanding the broader context. Together with the user, analyze access patterns to identify pain points and opportunities for optimization.\n\n#### Workflow\n\n**Step 1: Assess the environment**\nAsk the user:\n  - Is this a new design or is there a production database with existing access patterns to analyze?\n  - If there is production data, is it on Atlas? If yes, what tier? (M0\u002FM2\u002FM5 vs M10+)\n\n**Step 2: Determine workload type**\nIs the workload read-heavy, write-heavy, or balanced? This will influence which diagnostic sources are most relevant.\nAsk the user:\n- What's the primary workload for these collections — read-heavy (analytics, reports, searches), write-heavy (logging, IoT ingestion, frequent updates), or balanced?\n\nVerify with `db.serverStatus().opcounters`.\n\n**Step 3: Work with the user to choose the best source(s)**\n  Recommend the best source(s) for their situation, explaining the tradeoffs. For schema design decisions, we often need to combine multiple sources for a complete picture.\n\n**Step 4: Proceed with analysis**\n  Only after source selection, fetch data or guide the user through analysis.\n\n#### Sources\n\n- [Query statistics](references\u002Fsource-query-stats.md) - Returns runtime statistics for recorded queries showing query shapes and frequency. **Limitation**: Currently only captures read operations (pair with other sources for write patterns). Requires Atlas M10+ tier.\n- [Atlas Slow Query Logs](references\u002Fsource-slow-query-logs.md) - Review slow queries (actual queries, not shapes) to identify performance bottlenecks. Captures all reads and writes. Requires Atlas M10+ tier.\n- Codebase - Examine actual queries in application code to understand access patterns, especially for new applications or with changing workloads. Can be used in conjunction with query stats for a more complete picture.\n- Natural language input - Ask the user to describe their typical queries and access patterns in natural language. Can be used as the only source or to supplement and validate other sources - the user might have contextual knowledge that is not reflected in the data or codebase.\n\n**Combining Query Stats and Slow Query Logs:**\n\nUse both together for comprehensive analysis:\n1. Query Stats → identify frequent access patterns (which queries run most often)\n2. Slow Query Logs → identify performance bottlenecks (which queries are slow)\n3. Focus schema optimization on queries that are both frequent AND slow (highest impact)\n\n## Key Principle\n\n> **\"Data that is accessed together should be stored together.\"**\n\nThis is MongoDB's core philosophy. Embedding related data eliminates joins, reduces round trips, and enables atomic updates. Reference only when you must.\n\nA core way to implement this philosophy is the fact that MongoDB exposes **flexible schemas**. This means you can have different fields in different documents, and even different structures. This allows you to model data in the way that best fits your access patterns, without being constrained by a rigid schema. For example, if different documents have different sets of fields, that is perfectly fine as long as it serves your application's needs. You can also use schema validation to enforce certain rules while still allowing for flexibility.\n\nAnother implication of the key principle is that information about the expected read and write workload becomes very relevant to schema design. If pieces of information from different entities are often queried or updated together, that means that prioritizing co-location of that data in the same document can lead to significant performance benefits. On the other hand, if certain pieces of information are rarely accessed together, it may make sense to store them separately to avoid loading more data than necessary.\n\n#### Schema Fundamentals Summary\n\n- **Embed vs Reference**: Choose embedding or referencing based on access patterns: embed when data is always accessed together (1:1, 1:few, bounded arrays, atomic updates needed); reference when data is accessed independently, relationships are many-to-many, or arrays can grow without bound.\n- **Data accessed together stored together**: MongoDB's core principle: design schemas around queries, not entities. Embed related data to eliminate cross-collection joins and reduce round trips. Identify your API endpoints\u002Fpages, list the data each returns, then shape documents to match those queries.\n- **Embrace the document model**: Don't recreate SQL tables 1:1 as MongoDB collections. Instead, denormalize joined tables into rich documents for single-query reads and atomic updates. When migrating from SQL, identify tables that are always joined together and merge them into single documents.\n- **Schema validation**: Use MongoDB's built-in `$jsonSchema` validator to catch invalid data at the database level (type checks, required fields, enum constraints, array size limits). Start with `validationLevel: \"moderate\"` and `validationAction: \"warn\"` on existing collections, then tighten to `strict`\u002F`error`.\n- **16MB document limit**: MongoDB documents cannot exceed 16MB—this is a hard limit, not a guideline. Common causes: unbounded arrays, large embedded binaries, deeply nested objects. Mitigate by moving unbounded data to separate collections and monitoring document sizes with `$bsonSize`.\n\n## Embed\u002FReference Decision Framework\n\n| Relationship | Cardinality | Access Pattern | Recommendation |\n|-------------|-------------|----------------|----------------|\n| One-to-One | 1:1 | Always together | Embed |\n| One-to-Few | 1:N (N \u003C 100) | Usually together | Embed array |\n| One-to-Many | 1:N (N > 100) | Often separate | Reference |\n| Many-to-Many | M:N | Varies | Two-way reference |\n\nThis is a **rough** guideline, and whether to embed or reference depends on your specific access patterns, data size, and read\u002Fwrite frequencies. Always verify with your actual workload.\n\n## How to Use\n\nEach reference file listed above contains detailed explanations and code examples. Use the descriptions in the Quick Reference to identify which files are relevant to your current task.\n\nEach reference file contains:\n- Brief explanation of why it matters\n- Incorrect code example with explanation\n- Correct code example with explanation\n- \"When NOT to use\" exceptions\n- Performance impact and metrics\n- Verification diagnostics\n\n---\n\n## How These Rules Work\n\n### MongoDB MCP Integration\n\nFor automatic verification, connect the [MongoDB MCP Server](https:\u002F\u002Fgithub.com\u002Fmongodb-js\u002Fmongodb-mcp-server).\n\nIf the MCP server is running and connected, I can automatically run verification commands to check your actual schema, document sizes, array lengths, index usage, slow query logs, and more. This allows me to provide tailored recommendations based on your real data, not just code patterns.\n\n**⚠️ Security**: Use `--readOnly` for safety. Remove only if you need write operations.\n\nWhen connected, I can automatically:\n- Infer schema via `mcp__mongodb__collection-schema`\n- Measure document\u002Farray sizes via `mcp__mongodb__aggregate`\n- Check collection statistics via `mcp__mongodb__db-stats`\n\n### ⚠️ Action Policy\n\n**I will NEVER execute write operations without your explicit approval.**\n\nBefore any write or destructive operation via MCP, I will: (1) summarize the exact operation (collection, index\u002Fvalidator, estimated number of docs affected), and (2) ask for explicit confirmation (yes\u002Fno). I will not proceed on partial or ambiguous approvals.\n\n| Operation Type | MCP Tools | Action |\n|---------------|-----------|--------|\n| **Read (Safe)** | `find`, `aggregate`, `collection-schema`, `db-stats`, `count` | I may run automatically to verify |\n| **Write (Requires Approval)** | `update-many`, `insert-many`, `create-collection` | I will show the command and wait for your \"yes\" |\n| **Destructive (Requires Approval)** | `delete-many`, `drop-collection`, `drop-database` | I will warn you and require explicit confirmation |\n\nWhen I recommend schema changes or data modifications:\n1. I'll explain **what** I want to do and **why**\n2. I'll show you the **exact command**\n3. I'll **wait for your approval** before executing\n4. If you say \"go ahead\" or \"yes\", only then will I run it\n\n**Your database, your decision.** I'm here to advise, not to act unilaterally.\n\n### Working Together\n\nIf you're not sure about a recommendation:\n1. Run the verification commands I provide\n2. Share the output with me\n3. I'll adjust my recommendation based on your actual data\n\nWe're a team—let's get this right together.\n\n\n",{"data":41,"body":44},{"name":4,"description":6,"license":26,"metadata":42},{"version":43},"1.0.0",{"type":45,"children":46},"root",[47,55,61,68,73,128,134,141,178,184,231,237,361,367,372,379,390,403,413,421,435,445,455,461,503,511,516,535,541,553,558,570,575,581,680,686,816,828,834,839,844,877,881,887,893,907,912,930,935,971,977,985,990,1149,1154,1201,1211,1217,1222,1240],{"type":48,"tag":49,"props":50,"children":51},"element","h1",{"id":4},[52],{"type":53,"value":54},"text","MongoDB Schema Design",{"type":48,"tag":56,"props":57,"children":58},"p",{},[59],{"type":53,"value":60},"Data modeling patterns and anti-patterns for MongoDB, maintained by MongoDB. Bad schema is the root cause of most MongoDB performance and cost issues—queries and indexes cannot fix a fundamentally wrong model.",{"type":48,"tag":62,"props":63,"children":65},"h2",{"id":64},"when-to-apply",[66],{"type":53,"value":67},"When to Apply",{"type":48,"tag":56,"props":69,"children":70},{},[71],{"type":53,"value":72},"Reference these guidelines when:",{"type":48,"tag":74,"props":75,"children":76},"ul",{},[77,83,88,93,98,103,108,113,118,123],{"type":48,"tag":78,"props":79,"children":80},"li",{},[81],{"type":53,"value":82},"Designing a new MongoDB schema from scratch",{"type":48,"tag":78,"props":84,"children":85},{},[86],{"type":53,"value":87},"Migrating from SQL\u002Frelational databases to MongoDB",{"type":48,"tag":78,"props":89,"children":90},{},[91],{"type":53,"value":92},"Reviewing existing data models for performance issues",{"type":48,"tag":78,"props":94,"children":95},{},[96],{"type":53,"value":97},"Troubleshooting slow queries or growing document sizes",{"type":48,"tag":78,"props":99,"children":100},{},[101],{"type":53,"value":102},"Deciding between embedding and referencing",{"type":48,"tag":78,"props":104,"children":105},{},[106],{"type":53,"value":107},"Modeling relationships (one-to-one, one-to-many, many-to-many)",{"type":48,"tag":78,"props":109,"children":110},{},[111],{"type":53,"value":112},"Implementing tree\u002Fhierarchical structures",{"type":48,"tag":78,"props":114,"children":115},{},[116],{"type":53,"value":117},"Seeing Atlas Schema Suggestions or Performance Advisor warnings",{"type":48,"tag":78,"props":119,"children":120},{},[121],{"type":53,"value":122},"Hitting the 16MB document limit",{"type":48,"tag":78,"props":124,"children":125},{},[126],{"type":53,"value":127},"Adding schema validation to existing collections",{"type":48,"tag":62,"props":129,"children":131},{"id":130},"quick-reference",[132],{"type":53,"value":133},"Quick Reference",{"type":48,"tag":135,"props":136,"children":138},"h3",{"id":137},"_1-schema-anti-patterns-3-rules",[139],{"type":53,"value":140},"1. Schema Anti-Patterns - 3 rules",{"type":48,"tag":74,"props":142,"children":143},{},[144,156,167],{"type":48,"tag":78,"props":145,"children":146},{},[147,154],{"type":48,"tag":148,"props":149,"children":151},"a",{"href":150},"references\u002Fantipattern-unnecessary-collections.md",[152],{"type":53,"value":153},"antipattern-unnecessary-collections",{"type":53,"value":155}," - Splitting homogeneous data into multiple collections is often an anti-pattern; consult this reference to validate whether this is the case.",{"type":48,"tag":78,"props":157,"children":158},{},[159,165],{"type":48,"tag":148,"props":160,"children":162},{"href":161},"references\u002Fantipattern-excessive-lookups.md",[163],{"type":53,"value":164},"antipattern-excessive-lookups",{"type":53,"value":166}," - When encountering overly normalized collections that reference each other or frequent and possibly slow $lookup operations, consult this reference to validate whether this is problematic and how to fix it.",{"type":48,"tag":78,"props":168,"children":169},{},[170,176],{"type":48,"tag":148,"props":171,"children":173},{"href":172},"references\u002Fantipattern-unnecessary-indexes.md",[174],{"type":53,"value":175},"antipattern-unnecessary-indexes",{"type":53,"value":177}," - Consult this reference when indexes overlap or are not used by queries, to identify and remove unnecessary indexes that add overhead without benefit.",{"type":48,"tag":135,"props":179,"children":181},{"id":180},"_2-schema-fundamentals-4-rules",[182],{"type":53,"value":183},"2. Schema Fundamentals - 4 rules",{"type":48,"tag":74,"props":185,"children":186},{},[187,198,209,220],{"type":48,"tag":78,"props":188,"children":189},{},[190,196],{"type":48,"tag":148,"props":191,"children":193},{"href":192},"references\u002Ffundamental-embed-vs-reference.md",[194],{"type":53,"value":195},"fundamental-embed-vs-reference",{"type":53,"value":197}," - Consult this reference for approaches to modeling different types of relationships (1:1, 1:few, 1:many, many:many, tree\u002Fhierarchical data) and how to decide between embedding and referencing based on access patterns.",{"type":48,"tag":78,"props":199,"children":200},{},[201,207],{"type":48,"tag":148,"props":202,"children":204},{"href":203},"references\u002Ffundamental-document-model.md",[205],{"type":53,"value":206},"fundamental-document-model",{"type":53,"value":208}," - Fundamentals of the document model. Consult this reference when migrating from SQL or other normalized data to a document database like MongoDB.",{"type":48,"tag":78,"props":210,"children":211},{},[212,218],{"type":48,"tag":148,"props":213,"children":215},{"href":214},"references\u002Ffundamental-schema-validation.md",[216],{"type":53,"value":217},"fundamental-schema-validation",{"type":53,"value":219}," - Consult this reference when creating new collections, or adding validation to existing collections, for example in response to finding inconsistent document structures or data quality issues.",{"type":48,"tag":78,"props":221,"children":222},{},[223,229],{"type":48,"tag":148,"props":224,"children":226},{"href":225},"references\u002Ffundamental-document-size.md",[227],{"type":53,"value":228},"fundamental-document-size",{"type":53,"value":230}," - Consult this reference when documents hit the hard 16MB limit, or when accesses are slower than expected as a result of large documents.",{"type":48,"tag":135,"props":232,"children":234},{"id":233},"_3-design-patterns-11-rules",[235],{"type":53,"value":236},"3. Design Patterns - 11 rules",{"type":48,"tag":74,"props":238,"children":239},{},[240,251,262,273,284,295,306,317,328,339,350],{"type":48,"tag":78,"props":241,"children":242},{},[243,249],{"type":48,"tag":148,"props":244,"children":246},{"href":245},"references\u002Fpattern-approximation.md",[247],{"type":53,"value":248},"pattern-approximation",{"type":53,"value":250}," - Use approximate values for high-frequency counters",{"type":48,"tag":78,"props":252,"children":253},{},[254,260],{"type":48,"tag":148,"props":255,"children":257},{"href":256},"references\u002Fpattern-archive.md",[258],{"type":53,"value":259},"pattern-archive",{"type":53,"value":261}," - Move historical data to separate\u002Fcold storage for performance",{"type":48,"tag":78,"props":263,"children":264},{},[265,271],{"type":48,"tag":148,"props":266,"children":268},{"href":267},"references\u002Fpattern-attribute.md",[269],{"type":53,"value":270},"pattern-attribute",{"type":53,"value":272}," - Collapse many optional fields into key-value attributes",{"type":48,"tag":78,"props":274,"children":275},{},[276,282],{"type":48,"tag":148,"props":277,"children":279},{"href":278},"references\u002Fpattern-bucket.md",[280],{"type":53,"value":281},"pattern-bucket",{"type":53,"value":283}," - Group time-series or IoT data into buckets",{"type":48,"tag":78,"props":285,"children":286},{},[287,293],{"type":48,"tag":148,"props":288,"children":290},{"href":289},"references\u002Fpattern-computed.md",[291],{"type":53,"value":292},"pattern-computed",{"type":53,"value":294}," - Pre-calculate expensive aggregations",{"type":48,"tag":78,"props":296,"children":297},{},[298,304],{"type":48,"tag":148,"props":299,"children":301},{"href":300},"references\u002Fpattern-document-versioning.md",[302],{"type":53,"value":303},"pattern-document-versioning",{"type":53,"value":305}," - Track document changes to enable historical queries and audit trails",{"type":48,"tag":78,"props":307,"children":308},{},[309,315],{"type":48,"tag":148,"props":310,"children":312},{"href":311},"references\u002Fpattern-extended-reference.md",[313],{"type":53,"value":314},"pattern-extended-reference",{"type":53,"value":316}," - Cache frequently-accessed data from related entities",{"type":48,"tag":78,"props":318,"children":319},{},[320,326],{"type":48,"tag":148,"props":321,"children":323},{"href":322},"references\u002Fpattern-outlier.md",[324],{"type":53,"value":325},"pattern-outlier",{"type":53,"value":327}," - Handle collections in which a small subset of documents are much larger than the rest, to prevent outliers from dominating memory and index costs",{"type":48,"tag":78,"props":329,"children":330},{},[331,337],{"type":48,"tag":148,"props":332,"children":334},{"href":333},"references\u002Fpattern-polymorphic.md",[335],{"type":53,"value":336},"pattern-polymorphic",{"type":53,"value":338}," - Store different types of entities in the same collection, often when they are different types of the same base entity (e.g. different types of users or different types of products)",{"type":48,"tag":78,"props":340,"children":341},{},[342,348],{"type":48,"tag":148,"props":343,"children":345},{"href":344},"references\u002Fpattern-schema-versioning.md",[346],{"type":53,"value":347},"pattern-schema-versioning",{"type":53,"value":349}," - Schema evolution, preventing drift, and safe online migrations. Consult when encountering inconsistent document structures, or when planning a schema change that cannot be applied atomically.",{"type":48,"tag":78,"props":351,"children":352},{},[353,359],{"type":48,"tag":148,"props":354,"children":356},{"href":355},"references\u002Fpattern-time-series-collections.md",[357],{"type":53,"value":358},"pattern-time-series-collections",{"type":53,"value":360}," - Use native time series collections for high-frequency time series data",{"type":48,"tag":135,"props":362,"children":364},{"id":363},"access-pattern-analysis",[365],{"type":53,"value":366},"Access Pattern Analysis",{"type":48,"tag":56,"props":368,"children":369},{},[370],{"type":53,"value":371},"Do not immediately recommend a pattern or schema change without understanding the broader context. Together with the user, analyze access patterns to identify pain points and opportunities for optimization.",{"type":48,"tag":373,"props":374,"children":376},"h4",{"id":375},"workflow",[377],{"type":53,"value":378},"Workflow",{"type":48,"tag":56,"props":380,"children":381},{},[382,388],{"type":48,"tag":383,"props":384,"children":385},"strong",{},[386],{"type":53,"value":387},"Step 1: Assess the environment",{"type":53,"value":389},"\nAsk the user:",{"type":48,"tag":74,"props":391,"children":392},{},[393,398],{"type":48,"tag":78,"props":394,"children":395},{},[396],{"type":53,"value":397},"Is this a new design or is there a production database with existing access patterns to analyze?",{"type":48,"tag":78,"props":399,"children":400},{},[401],{"type":53,"value":402},"If there is production data, is it on Atlas? If yes, what tier? (M0\u002FM2\u002FM5 vs M10+)",{"type":48,"tag":56,"props":404,"children":405},{},[406,411],{"type":48,"tag":383,"props":407,"children":408},{},[409],{"type":53,"value":410},"Step 2: Determine workload type",{"type":53,"value":412},"\nIs the workload read-heavy, write-heavy, or balanced? This will influence which diagnostic sources are most relevant.\nAsk the user:",{"type":48,"tag":74,"props":414,"children":415},{},[416],{"type":48,"tag":78,"props":417,"children":418},{},[419],{"type":53,"value":420},"What's the primary workload for these collections — read-heavy (analytics, reports, searches), write-heavy (logging, IoT ingestion, frequent updates), or balanced?",{"type":48,"tag":56,"props":422,"children":423},{},[424,426,433],{"type":53,"value":425},"Verify with ",{"type":48,"tag":427,"props":428,"children":430},"code",{"className":429},[],[431],{"type":53,"value":432},"db.serverStatus().opcounters",{"type":53,"value":434},".",{"type":48,"tag":56,"props":436,"children":437},{},[438,443],{"type":48,"tag":383,"props":439,"children":440},{},[441],{"type":53,"value":442},"Step 3: Work with the user to choose the best source(s)",{"type":53,"value":444},"\nRecommend the best source(s) for their situation, explaining the tradeoffs. For schema design decisions, we often need to combine multiple sources for a complete picture.",{"type":48,"tag":56,"props":446,"children":447},{},[448,453],{"type":48,"tag":383,"props":449,"children":450},{},[451],{"type":53,"value":452},"Step 4: Proceed with analysis",{"type":53,"value":454},"\nOnly after source selection, fetch data or guide the user through analysis.",{"type":48,"tag":373,"props":456,"children":458},{"id":457},"sources",[459],{"type":53,"value":460},"Sources",{"type":48,"tag":74,"props":462,"children":463},{},[464,482,493,498],{"type":48,"tag":78,"props":465,"children":466},{},[467,473,475,480],{"type":48,"tag":148,"props":468,"children":470},{"href":469},"references\u002Fsource-query-stats.md",[471],{"type":53,"value":472},"Query statistics",{"type":53,"value":474}," - Returns runtime statistics for recorded queries showing query shapes and frequency. ",{"type":48,"tag":383,"props":476,"children":477},{},[478],{"type":53,"value":479},"Limitation",{"type":53,"value":481},": Currently only captures read operations (pair with other sources for write patterns). Requires Atlas M10+ tier.",{"type":48,"tag":78,"props":483,"children":484},{},[485,491],{"type":48,"tag":148,"props":486,"children":488},{"href":487},"references\u002Fsource-slow-query-logs.md",[489],{"type":53,"value":490},"Atlas Slow Query Logs",{"type":53,"value":492}," - Review slow queries (actual queries, not shapes) to identify performance bottlenecks. Captures all reads and writes. Requires Atlas M10+ tier.",{"type":48,"tag":78,"props":494,"children":495},{},[496],{"type":53,"value":497},"Codebase - Examine actual queries in application code to understand access patterns, especially for new applications or with changing workloads. Can be used in conjunction with query stats for a more complete picture.",{"type":48,"tag":78,"props":499,"children":500},{},[501],{"type":53,"value":502},"Natural language input - Ask the user to describe their typical queries and access patterns in natural language. Can be used as the only source or to supplement and validate other sources - the user might have contextual knowledge that is not reflected in the data or codebase.",{"type":48,"tag":56,"props":504,"children":505},{},[506],{"type":48,"tag":383,"props":507,"children":508},{},[509],{"type":53,"value":510},"Combining Query Stats and Slow Query Logs:",{"type":48,"tag":56,"props":512,"children":513},{},[514],{"type":53,"value":515},"Use both together for comprehensive analysis:",{"type":48,"tag":517,"props":518,"children":519},"ol",{},[520,525,530],{"type":48,"tag":78,"props":521,"children":522},{},[523],{"type":53,"value":524},"Query Stats → identify frequent access patterns (which queries run most often)",{"type":48,"tag":78,"props":526,"children":527},{},[528],{"type":53,"value":529},"Slow Query Logs → identify performance bottlenecks (which queries are slow)",{"type":48,"tag":78,"props":531,"children":532},{},[533],{"type":53,"value":534},"Focus schema optimization on queries that are both frequent AND slow (highest impact)",{"type":48,"tag":62,"props":536,"children":538},{"id":537},"key-principle",[539],{"type":53,"value":540},"Key Principle",{"type":48,"tag":542,"props":543,"children":544},"blockquote",{},[545],{"type":48,"tag":56,"props":546,"children":547},{},[548],{"type":48,"tag":383,"props":549,"children":550},{},[551],{"type":53,"value":552},"\"Data that is accessed together should be stored together.\"",{"type":48,"tag":56,"props":554,"children":555},{},[556],{"type":53,"value":557},"This is MongoDB's core philosophy. Embedding related data eliminates joins, reduces round trips, and enables atomic updates. Reference only when you must.",{"type":48,"tag":56,"props":559,"children":560},{},[561,563,568],{"type":53,"value":562},"A core way to implement this philosophy is the fact that MongoDB exposes ",{"type":48,"tag":383,"props":564,"children":565},{},[566],{"type":53,"value":567},"flexible schemas",{"type":53,"value":569},". This means you can have different fields in different documents, and even different structures. This allows you to model data in the way that best fits your access patterns, without being constrained by a rigid schema. For example, if different documents have different sets of fields, that is perfectly fine as long as it serves your application's needs. You can also use schema validation to enforce certain rules while still allowing for flexibility.",{"type":48,"tag":56,"props":571,"children":572},{},[573],{"type":53,"value":574},"Another implication of the key principle is that information about the expected read and write workload becomes very relevant to schema design. If pieces of information from different entities are often queried or updated together, that means that prioritizing co-location of that data in the same document can lead to significant performance benefits. On the other hand, if certain pieces of information are rarely accessed together, it may make sense to store them separately to avoid loading more data than necessary.",{"type":48,"tag":373,"props":576,"children":578},{"id":577},"schema-fundamentals-summary",[579],{"type":53,"value":580},"Schema Fundamentals Summary",{"type":48,"tag":74,"props":582,"children":583},{},[584,594,604,614,663],{"type":48,"tag":78,"props":585,"children":586},{},[587,592],{"type":48,"tag":383,"props":588,"children":589},{},[590],{"type":53,"value":591},"Embed vs Reference",{"type":53,"value":593},": Choose embedding or referencing based on access patterns: embed when data is always accessed together (1:1, 1:few, bounded arrays, atomic updates needed); reference when data is accessed independently, relationships are many-to-many, or arrays can grow without bound.",{"type":48,"tag":78,"props":595,"children":596},{},[597,602],{"type":48,"tag":383,"props":598,"children":599},{},[600],{"type":53,"value":601},"Data accessed together stored together",{"type":53,"value":603},": MongoDB's core principle: design schemas around queries, not entities. Embed related data to eliminate cross-collection joins and reduce round trips. Identify your API endpoints\u002Fpages, list the data each returns, then shape documents to match those queries.",{"type":48,"tag":78,"props":605,"children":606},{},[607,612],{"type":48,"tag":383,"props":608,"children":609},{},[610],{"type":53,"value":611},"Embrace the document model",{"type":53,"value":613},": Don't recreate SQL tables 1:1 as MongoDB collections. Instead, denormalize joined tables into rich documents for single-query reads and atomic updates. When migrating from SQL, identify tables that are always joined together and merge them into single documents.",{"type":48,"tag":78,"props":615,"children":616},{},[617,622,624,630,632,638,640,646,648,654,656,662],{"type":48,"tag":383,"props":618,"children":619},{},[620],{"type":53,"value":621},"Schema validation",{"type":53,"value":623},": Use MongoDB's built-in ",{"type":48,"tag":427,"props":625,"children":627},{"className":626},[],[628],{"type":53,"value":629},"$jsonSchema",{"type":53,"value":631}," validator to catch invalid data at the database level (type checks, required fields, enum constraints, array size limits). Start with ",{"type":48,"tag":427,"props":633,"children":635},{"className":634},[],[636],{"type":53,"value":637},"validationLevel: \"moderate\"",{"type":53,"value":639}," and ",{"type":48,"tag":427,"props":641,"children":643},{"className":642},[],[644],{"type":53,"value":645},"validationAction: \"warn\"",{"type":53,"value":647}," on existing collections, then tighten to ",{"type":48,"tag":427,"props":649,"children":651},{"className":650},[],[652],{"type":53,"value":653},"strict",{"type":53,"value":655},"\u002F",{"type":48,"tag":427,"props":657,"children":659},{"className":658},[],[660],{"type":53,"value":661},"error",{"type":53,"value":434},{"type":48,"tag":78,"props":664,"children":665},{},[666,671,673,679],{"type":48,"tag":383,"props":667,"children":668},{},[669],{"type":53,"value":670},"16MB document limit",{"type":53,"value":672},": MongoDB documents cannot exceed 16MB—this is a hard limit, not a guideline. Common causes: unbounded arrays, large embedded binaries, deeply nested objects. Mitigate by moving unbounded data to separate collections and monitoring document sizes with ",{"type":48,"tag":427,"props":674,"children":676},{"className":675},[],[677],{"type":53,"value":678},"$bsonSize",{"type":53,"value":434},{"type":48,"tag":62,"props":681,"children":683},{"id":682},"embedreference-decision-framework",[684],{"type":53,"value":685},"Embed\u002FReference Decision Framework",{"type":48,"tag":687,"props":688,"children":689},"table",{},[690,719],{"type":48,"tag":691,"props":692,"children":693},"thead",{},[694],{"type":48,"tag":695,"props":696,"children":697},"tr",{},[698,704,709,714],{"type":48,"tag":699,"props":700,"children":701},"th",{},[702],{"type":53,"value":703},"Relationship",{"type":48,"tag":699,"props":705,"children":706},{},[707],{"type":53,"value":708},"Cardinality",{"type":48,"tag":699,"props":710,"children":711},{},[712],{"type":53,"value":713},"Access Pattern",{"type":48,"tag":699,"props":715,"children":716},{},[717],{"type":53,"value":718},"Recommendation",{"type":48,"tag":720,"props":721,"children":722},"tbody",{},[723,747,770,793],{"type":48,"tag":695,"props":724,"children":725},{},[726,732,737,742],{"type":48,"tag":727,"props":728,"children":729},"td",{},[730],{"type":53,"value":731},"One-to-One",{"type":48,"tag":727,"props":733,"children":734},{},[735],{"type":53,"value":736},"1:1",{"type":48,"tag":727,"props":738,"children":739},{},[740],{"type":53,"value":741},"Always together",{"type":48,"tag":727,"props":743,"children":744},{},[745],{"type":53,"value":746},"Embed",{"type":48,"tag":695,"props":748,"children":749},{},[750,755,760,765],{"type":48,"tag":727,"props":751,"children":752},{},[753],{"type":53,"value":754},"One-to-Few",{"type":48,"tag":727,"props":756,"children":757},{},[758],{"type":53,"value":759},"1:N (N \u003C 100)",{"type":48,"tag":727,"props":761,"children":762},{},[763],{"type":53,"value":764},"Usually together",{"type":48,"tag":727,"props":766,"children":767},{},[768],{"type":53,"value":769},"Embed array",{"type":48,"tag":695,"props":771,"children":772},{},[773,778,783,788],{"type":48,"tag":727,"props":774,"children":775},{},[776],{"type":53,"value":777},"One-to-Many",{"type":48,"tag":727,"props":779,"children":780},{},[781],{"type":53,"value":782},"1:N (N > 100)",{"type":48,"tag":727,"props":784,"children":785},{},[786],{"type":53,"value":787},"Often separate",{"type":48,"tag":727,"props":789,"children":790},{},[791],{"type":53,"value":792},"Reference",{"type":48,"tag":695,"props":794,"children":795},{},[796,801,806,811],{"type":48,"tag":727,"props":797,"children":798},{},[799],{"type":53,"value":800},"Many-to-Many",{"type":48,"tag":727,"props":802,"children":803},{},[804],{"type":53,"value":805},"M:N",{"type":48,"tag":727,"props":807,"children":808},{},[809],{"type":53,"value":810},"Varies",{"type":48,"tag":727,"props":812,"children":813},{},[814],{"type":53,"value":815},"Two-way reference",{"type":48,"tag":56,"props":817,"children":818},{},[819,821,826],{"type":53,"value":820},"This is a ",{"type":48,"tag":383,"props":822,"children":823},{},[824],{"type":53,"value":825},"rough",{"type":53,"value":827}," guideline, and whether to embed or reference depends on your specific access patterns, data size, and read\u002Fwrite frequencies. Always verify with your actual workload.",{"type":48,"tag":62,"props":829,"children":831},{"id":830},"how-to-use",[832],{"type":53,"value":833},"How to Use",{"type":48,"tag":56,"props":835,"children":836},{},[837],{"type":53,"value":838},"Each reference file listed above contains detailed explanations and code examples. Use the descriptions in the Quick Reference to identify which files are relevant to your current task.",{"type":48,"tag":56,"props":840,"children":841},{},[842],{"type":53,"value":843},"Each reference file contains:",{"type":48,"tag":74,"props":845,"children":846},{},[847,852,857,862,867,872],{"type":48,"tag":78,"props":848,"children":849},{},[850],{"type":53,"value":851},"Brief explanation of why it matters",{"type":48,"tag":78,"props":853,"children":854},{},[855],{"type":53,"value":856},"Incorrect code example with explanation",{"type":48,"tag":78,"props":858,"children":859},{},[860],{"type":53,"value":861},"Correct code example with explanation",{"type":48,"tag":78,"props":863,"children":864},{},[865],{"type":53,"value":866},"\"When NOT to use\" exceptions",{"type":48,"tag":78,"props":868,"children":869},{},[870],{"type":53,"value":871},"Performance impact and metrics",{"type":48,"tag":78,"props":873,"children":874},{},[875],{"type":53,"value":876},"Verification diagnostics",{"type":48,"tag":878,"props":879,"children":880},"hr",{},[],{"type":48,"tag":62,"props":882,"children":884},{"id":883},"how-these-rules-work",[885],{"type":53,"value":886},"How These Rules Work",{"type":48,"tag":135,"props":888,"children":890},{"id":889},"mongodb-mcp-integration",[891],{"type":53,"value":892},"MongoDB MCP Integration",{"type":48,"tag":56,"props":894,"children":895},{},[896,898,906],{"type":53,"value":897},"For automatic verification, connect the ",{"type":48,"tag":148,"props":899,"children":903},{"href":900,"rel":901},"https:\u002F\u002Fgithub.com\u002Fmongodb-js\u002Fmongodb-mcp-server",[902],"nofollow",[904],{"type":53,"value":905},"MongoDB MCP Server",{"type":53,"value":434},{"type":48,"tag":56,"props":908,"children":909},{},[910],{"type":53,"value":911},"If the MCP server is running and connected, I can automatically run verification commands to check your actual schema, document sizes, array lengths, index usage, slow query logs, and more. This allows me to provide tailored recommendations based on your real data, not just code patterns.",{"type":48,"tag":56,"props":913,"children":914},{},[915,920,922,928],{"type":48,"tag":383,"props":916,"children":917},{},[918],{"type":53,"value":919},"⚠️ Security",{"type":53,"value":921},": Use ",{"type":48,"tag":427,"props":923,"children":925},{"className":924},[],[926],{"type":53,"value":927},"--readOnly",{"type":53,"value":929}," for safety. Remove only if you need write operations.",{"type":48,"tag":56,"props":931,"children":932},{},[933],{"type":53,"value":934},"When connected, I can automatically:",{"type":48,"tag":74,"props":936,"children":937},{},[938,949,960],{"type":48,"tag":78,"props":939,"children":940},{},[941,943],{"type":53,"value":942},"Infer schema via ",{"type":48,"tag":427,"props":944,"children":946},{"className":945},[],[947],{"type":53,"value":948},"mcp__mongodb__collection-schema",{"type":48,"tag":78,"props":950,"children":951},{},[952,954],{"type":53,"value":953},"Measure document\u002Farray sizes via ",{"type":48,"tag":427,"props":955,"children":957},{"className":956},[],[958],{"type":53,"value":959},"mcp__mongodb__aggregate",{"type":48,"tag":78,"props":961,"children":962},{},[963,965],{"type":53,"value":964},"Check collection statistics via ",{"type":48,"tag":427,"props":966,"children":968},{"className":967},[],[969],{"type":53,"value":970},"mcp__mongodb__db-stats",{"type":48,"tag":135,"props":972,"children":974},{"id":973},"️-action-policy",[975],{"type":53,"value":976},"⚠️ Action Policy",{"type":48,"tag":56,"props":978,"children":979},{},[980],{"type":48,"tag":383,"props":981,"children":982},{},[983],{"type":53,"value":984},"I will NEVER execute write operations without your explicit approval.",{"type":48,"tag":56,"props":986,"children":987},{},[988],{"type":53,"value":989},"Before any write or destructive operation via MCP, I will: (1) summarize the exact operation (collection, index\u002Fvalidator, estimated number of docs affected), and (2) ask for explicit confirmation (yes\u002Fno). I will not proceed on partial or ambiguous approvals.",{"type":48,"tag":687,"props":991,"children":992},{},[993,1014],{"type":48,"tag":691,"props":994,"children":995},{},[996],{"type":48,"tag":695,"props":997,"children":998},{},[999,1004,1009],{"type":48,"tag":699,"props":1000,"children":1001},{},[1002],{"type":53,"value":1003},"Operation Type",{"type":48,"tag":699,"props":1005,"children":1006},{},[1007],{"type":53,"value":1008},"MCP Tools",{"type":48,"tag":699,"props":1010,"children":1011},{},[1012],{"type":53,"value":1013},"Action",{"type":48,"tag":720,"props":1015,"children":1016},{},[1017,1071,1110],{"type":48,"tag":695,"props":1018,"children":1019},{},[1020,1028,1066],{"type":48,"tag":727,"props":1021,"children":1022},{},[1023],{"type":48,"tag":383,"props":1024,"children":1025},{},[1026],{"type":53,"value":1027},"Read (Safe)",{"type":48,"tag":727,"props":1029,"children":1030},{},[1031,1037,1039,1045,1046,1052,1053,1059,1060],{"type":48,"tag":427,"props":1032,"children":1034},{"className":1033},[],[1035],{"type":53,"value":1036},"find",{"type":53,"value":1038},", ",{"type":48,"tag":427,"props":1040,"children":1042},{"className":1041},[],[1043],{"type":53,"value":1044},"aggregate",{"type":53,"value":1038},{"type":48,"tag":427,"props":1047,"children":1049},{"className":1048},[],[1050],{"type":53,"value":1051},"collection-schema",{"type":53,"value":1038},{"type":48,"tag":427,"props":1054,"children":1056},{"className":1055},[],[1057],{"type":53,"value":1058},"db-stats",{"type":53,"value":1038},{"type":48,"tag":427,"props":1061,"children":1063},{"className":1062},[],[1064],{"type":53,"value":1065},"count",{"type":48,"tag":727,"props":1067,"children":1068},{},[1069],{"type":53,"value":1070},"I may run automatically to verify",{"type":48,"tag":695,"props":1072,"children":1073},{},[1074,1082,1105],{"type":48,"tag":727,"props":1075,"children":1076},{},[1077],{"type":48,"tag":383,"props":1078,"children":1079},{},[1080],{"type":53,"value":1081},"Write (Requires Approval)",{"type":48,"tag":727,"props":1083,"children":1084},{},[1085,1091,1092,1098,1099],{"type":48,"tag":427,"props":1086,"children":1088},{"className":1087},[],[1089],{"type":53,"value":1090},"update-many",{"type":53,"value":1038},{"type":48,"tag":427,"props":1093,"children":1095},{"className":1094},[],[1096],{"type":53,"value":1097},"insert-many",{"type":53,"value":1038},{"type":48,"tag":427,"props":1100,"children":1102},{"className":1101},[],[1103],{"type":53,"value":1104},"create-collection",{"type":48,"tag":727,"props":1106,"children":1107},{},[1108],{"type":53,"value":1109},"I will show the command and wait for your \"yes\"",{"type":48,"tag":695,"props":1111,"children":1112},{},[1113,1121,1144],{"type":48,"tag":727,"props":1114,"children":1115},{},[1116],{"type":48,"tag":383,"props":1117,"children":1118},{},[1119],{"type":53,"value":1120},"Destructive (Requires Approval)",{"type":48,"tag":727,"props":1122,"children":1123},{},[1124,1130,1131,1137,1138],{"type":48,"tag":427,"props":1125,"children":1127},{"className":1126},[],[1128],{"type":53,"value":1129},"delete-many",{"type":53,"value":1038},{"type":48,"tag":427,"props":1132,"children":1134},{"className":1133},[],[1135],{"type":53,"value":1136},"drop-collection",{"type":53,"value":1038},{"type":48,"tag":427,"props":1139,"children":1141},{"className":1140},[],[1142],{"type":53,"value":1143},"drop-database",{"type":48,"tag":727,"props":1145,"children":1146},{},[1147],{"type":53,"value":1148},"I will warn you and require explicit confirmation",{"type":48,"tag":56,"props":1150,"children":1151},{},[1152],{"type":53,"value":1153},"When I recommend schema changes or data modifications:",{"type":48,"tag":517,"props":1155,"children":1156},{},[1157,1174,1184,1196],{"type":48,"tag":78,"props":1158,"children":1159},{},[1160,1162,1167,1169],{"type":53,"value":1161},"I'll explain ",{"type":48,"tag":383,"props":1163,"children":1164},{},[1165],{"type":53,"value":1166},"what",{"type":53,"value":1168}," I want to do and ",{"type":48,"tag":383,"props":1170,"children":1171},{},[1172],{"type":53,"value":1173},"why",{"type":48,"tag":78,"props":1175,"children":1176},{},[1177,1179],{"type":53,"value":1178},"I'll show you the ",{"type":48,"tag":383,"props":1180,"children":1181},{},[1182],{"type":53,"value":1183},"exact command",{"type":48,"tag":78,"props":1185,"children":1186},{},[1187,1189,1194],{"type":53,"value":1188},"I'll ",{"type":48,"tag":383,"props":1190,"children":1191},{},[1192],{"type":53,"value":1193},"wait for your approval",{"type":53,"value":1195}," before executing",{"type":48,"tag":78,"props":1197,"children":1198},{},[1199],{"type":53,"value":1200},"If you say \"go ahead\" or \"yes\", only then will I run it",{"type":48,"tag":56,"props":1202,"children":1203},{},[1204,1209],{"type":48,"tag":383,"props":1205,"children":1206},{},[1207],{"type":53,"value":1208},"Your database, your decision.",{"type":53,"value":1210}," I'm here to advise, not to act unilaterally.",{"type":48,"tag":135,"props":1212,"children":1214},{"id":1213},"working-together",[1215],{"type":53,"value":1216},"Working Together",{"type":48,"tag":56,"props":1218,"children":1219},{},[1220],{"type":53,"value":1221},"If you're not sure about a recommendation:",{"type":48,"tag":517,"props":1223,"children":1224},{},[1225,1230,1235],{"type":48,"tag":78,"props":1226,"children":1227},{},[1228],{"type":53,"value":1229},"Run the verification commands I provide",{"type":48,"tag":78,"props":1231,"children":1232},{},[1233],{"type":53,"value":1234},"Share the output with me",{"type":48,"tag":78,"props":1236,"children":1237},{},[1238],{"type":53,"value":1239},"I'll adjust my recommendation based on your actual data",{"type":48,"tag":56,"props":1241,"children":1242},{},[1243],{"type":53,"value":1244},"We're a team—let's get this right together.",{"items":1246,"total":1334},[1247,1262,1272,1285,1297,1310,1317],{"slug":1248,"name":1248,"fn":1249,"description":1250,"org":1251,"tags":1252,"stars":23,"repoUrl":24,"updatedAt":1261},"mongodb-atlas-stream-processing","manage MongoDB Atlas Stream Processing workflows","Manages MongoDB Atlas Stream Processing (ASP) workflows. Handles workspace provisioning, data source\u002Fsink connections, processor lifecycle operations, debugging diagnostics, and tier sizing. Supports Kafka, Atlas clusters, S3, HTTPS, and Lambda integrations for streaming data workloads and event processing. NOT for general MongoDB queries or Atlas cluster management. Requires MongoDB MCP Server with Atlas API credentials.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1253,1256,1259,1260],{"name":1254,"slug":1255,"type":15},"Data Engineering","data-engineering",{"name":1257,"slug":1258,"type":15},"Data Pipeline","data-pipeline",{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},"2026-07-13T06:15:32.953796",{"slug":1263,"name":1263,"fn":1264,"description":1265,"org":1266,"tags":1267,"stars":23,"repoUrl":24,"updatedAt":1271},"mongodb-connection","configure MongoDB client connections","Optimize MongoDB client connection configuration (pools, timeouts, patterns) for any supported driver language. Use this skill when working\u002Fupdating\u002Freviewing on functions that instantiate or configure a MongoDB client (eg, when calling `connect()`), configuring connection pools, troubleshooting connection errors (ECONNREFUSED, timeouts, pool exhaustion), optimizing performance issues related to connections. This includes scenarios like building serverless functions with MongoDB, creating API endpoints that use MongoDB, optimizing high-traffic MongoDB applications, creating long-running tasks and concurrency, or debugging connection-related failures.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1268,1269,1270],{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},"2026-07-13T06:15:26.144554",{"slug":1273,"name":1273,"fn":1274,"description":1275,"org":1276,"tags":1277,"stars":23,"repoUrl":24,"updatedAt":1284},"mongodb-mcp-setup","configure MongoDB MCP server","Guide users through configuring key MongoDB MCP server options. Use this skill when a user has the MongoDB MCP server installed but hasn't configured the required environment variables, or when they ask about connecting to MongoDB\u002FAtlas and don't have the credentials set up.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1278,1281,1283],{"name":1279,"slug":1280,"type":15},"Configuration","configuration",{"name":1282,"slug":33,"type":15},"MCP",{"name":9,"slug":8,"type":15},"2026-07-16T06:00:24.26424",{"slug":1286,"name":1286,"fn":1287,"description":1288,"org":1289,"tags":1290,"stars":23,"repoUrl":24,"updatedAt":1296},"mongodb-natural-language-querying","generate MongoDB queries from natural language","Generate read-only MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents. Use this skill whenever the user asks to write, create, or generate MongoDB queries, wants to filter\u002Fquery\u002Faggregate data in MongoDB, asks \"how do I query...\", needs help with query syntax, or discusses finding\u002Ffiltering\u002Fgrouping MongoDB documents. Also use for translating SQL-like requests to MongoDB syntax. Does NOT handle Atlas Search ($search operator), vector\u002Fsemantic search ($vectorSearch operator), fuzzy matching, autocomplete indexes, or relevance scoring - use search-and-ai for those. Does NOT analyze or optimize existing queries - use mongodb-query-optimizer for that. Does NOT handle aggregation pipelines that involve write operations. Requires MongoDB MCP server.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1291,1294,1295],{"name":1292,"slug":1293,"type":15},"Data Analysis","data-analysis",{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},"2026-07-16T06:02:02.491655",{"slug":1298,"name":1298,"fn":1299,"description":1300,"org":1301,"tags":1302,"stars":23,"repoUrl":24,"updatedAt":1309},"mongodb-query-optimizer","optimize MongoDB queries and indexes","Help with MongoDB query optimization and indexing. Use only when the user asks for optimization or performance: \"How do I optimize this query?\", \"How do I index this?\", \"Why is this query slow?\", \"Can you fix my slow queries?\", \"What are the slow queries on my cluster?\", etc. Do not invoke for general MongoDB query writing unless user asks for performance or index help. Prefer indexing as optimization strategy. Use MongoDB MCP when available.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1303,1304,1307,1308],{"name":18,"slug":19,"type":15},{"name":1305,"slug":1306,"type":15},"Debugging","debugging",{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},"2026-07-13T06:15:44.51826",{"slug":4,"name":4,"fn":5,"description":6,"org":1311,"tags":1312,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1313,1314,1315,1316],{"name":21,"slug":22,"type":15},{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":1318,"name":1318,"fn":1319,"description":1320,"org":1321,"tags":1322,"stars":23,"repoUrl":24,"updatedAt":1333},"mongodb-search-and-ai","implement Atlas Search and Vector Search","Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when users need to build search functionality for text-based queries (autocomplete, fuzzy matching, faceted search), semantic similarity (embeddings, RAG applications), or combined approaches. Also use when users need text containment, substring matching ('contains', 'includes', 'appears in'), case-insensitive or multi-field text search, or filtering across many fields with variable combinations. Provides workflows for selecting the right search type, creating indexes, constructing queries, and optimizing performance using the MongoDB MCP server.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1323,1326,1327,1330],{"name":1324,"slug":1325,"type":15},"LLM","llm",{"name":9,"slug":8,"type":15},{"name":1328,"slug":1329,"type":15},"RAG","rag",{"name":1331,"slug":1332,"type":15},"Search","search","2026-07-16T06:01:58.645908",7,{"items":1336,"total":1418},[1337,1344,1350,1356,1362,1369,1376,1383,1400],{"slug":1248,"name":1248,"fn":1249,"description":1250,"org":1338,"tags":1339,"stars":23,"repoUrl":24,"updatedAt":1261},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1340,1341,1342,1343],{"name":1254,"slug":1255,"type":15},{"name":1257,"slug":1258,"type":15},{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"slug":1263,"name":1263,"fn":1264,"description":1265,"org":1345,"tags":1346,"stars":23,"repoUrl":24,"updatedAt":1271},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1347,1348,1349],{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":1273,"name":1273,"fn":1274,"description":1275,"org":1351,"tags":1352,"stars":23,"repoUrl":24,"updatedAt":1284},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1353,1354,1355],{"name":1279,"slug":1280,"type":15},{"name":1282,"slug":33,"type":15},{"name":9,"slug":8,"type":15},{"slug":1286,"name":1286,"fn":1287,"description":1288,"org":1357,"tags":1358,"stars":23,"repoUrl":24,"updatedAt":1296},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1359,1360,1361],{"name":1292,"slug":1293,"type":15},{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"slug":1298,"name":1298,"fn":1299,"description":1300,"org":1363,"tags":1364,"stars":23,"repoUrl":24,"updatedAt":1309},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1365,1366,1367,1368],{"name":18,"slug":19,"type":15},{"name":1305,"slug":1306,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":4,"name":4,"fn":5,"description":6,"org":1370,"tags":1371,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1372,1373,1374,1375],{"name":21,"slug":22,"type":15},{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":1318,"name":1318,"fn":1319,"description":1320,"org":1377,"tags":1378,"stars":23,"repoUrl":24,"updatedAt":1333},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1379,1380,1381,1382],{"name":1324,"slug":1325,"type":15},{"name":9,"slug":8,"type":15},{"name":1328,"slug":1329,"type":15},{"name":1331,"slug":1332,"type":15},{"slug":1384,"name":1384,"fn":1385,"description":1386,"org":1387,"tags":1388,"stars":1397,"repoUrl":1398,"updatedAt":1399},"kafka-to-asp","migrate Kafka connectors to Atlas Stream Processing","Converts MongoDB Kafka managed connector configurations (MongoDbAtlasSource \u002F MongoDbAtlasSink) to equivalent Atlas Stream Processing processors. One-time migration workflow: reads connector JSON, validates it, maps fields to ASP pipeline stages, and creates connections and processors via the MongoDB MCP Server. Requires MongoDB MCP Server with Atlas API credentials.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1389,1390,1393,1396],{"name":1257,"slug":1258,"type":15},{"name":1391,"slug":1392,"type":15},"ETL","etl",{"name":1394,"slug":1395,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},10,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002FASP_example","2026-07-16T06:02:02.15744",{"slug":1401,"name":1401,"fn":1402,"description":1403,"org":1404,"tags":1405,"stars":1415,"repoUrl":1416,"updatedAt":1417},"tines","manage Tines security automation workflows","Use when creating, modifying, or managing Tines stories, actions, workflows, or automations. Also use when the user mentions Tines, asks about building SOAR workflows, or wants to automate security operations. Triggers on keywords like tines, story, action, webhook, workflow automation, SOAR.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1406,1409,1412],{"name":1407,"slug":1408,"type":15},"Automation","automation",{"name":1410,"slug":1411,"type":15},"Security","security",{"name":1413,"slug":1414,"type":15},"Workflow Automation","workflow-automation",1,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002Ftines-claude","2026-07-13T06:15:24.618317",9]