[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-azure-documentdb-query-optimizer":3,"mdc--tatkw6-key":38,"related-org-azure-documentdb-query-optimizer":2421,"related-repo-azure-documentdb-query-optimizer":2598},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":27,"repoUrl":28,"updatedAt":29,"license":30,"forks":31,"topics":32,"repo":33,"sourceUrl":36,"mdContent":37},"documentdb-query-optimizer","optimize Azure DocumentDB queries and indexes","Help with DocumentDB\u002FMongoDB query optimization and indexing for Azure DocumentDB. 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?\", etc. Do not invoke for general query writing unless user asks for performance or index help. Prefer indexing as optimization strategy. Use DocumentDB MCP when available.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"azure","Azure (Microsoft)","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fazure.png","Azure",[13,17,18,21,24],{"name":14,"slug":15,"type":16},"Performance","performance","tag",{"name":11,"slug":8,"type":16},{"name":19,"slug":20,"type":16},"Cosmos DB","cosmos-db",{"name":22,"slug":23,"type":16},"Database","database",{"name":25,"slug":26,"type":16},"Debugging","debugging",5,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fdocumentdb-agent-kit","2026-08-01T05:42:32.441157",null,7,[],{"repoUrl":28,"stars":27,"forks":31,"topics":34,"description":35},[],"Agent Skills pack for Azure DocumentDB (MongoDB compatibility) - vector search, full-text search, query optimization, connection tuning, local deployment, security, HA, and MCP setup.","https:\u002F\u002Fgithub.com\u002FAzure\u002Fdocumentdb-agent-kit\u002Ftree\u002FHEAD\u002Fskills\u002Fquery-optimizer","---\nname: documentdb-query-optimizer\ndescription: >-\n  Help with DocumentDB\u002FMongoDB query optimization and indexing for Azure\n  DocumentDB. Use only when the user asks for optimization or\n  performance: \"How do I optimize this query?\", \"How do I index this?\", \"Why is\n  this query slow?\", \"Can you fix my slow queries?\", etc. Do not invoke for\n  general query writing unless user asks for performance or index help. Prefer\n  indexing as optimization strategy. Use DocumentDB MCP when available.\nallowed-tools: mcp__documentdb__*\n---\n\n# DocumentDB Query Optimizer\n\n## When This Skill Is Invoked\n\nInvoke **only** when the user wants:\n\n- Query\u002Findex **optimization** or **performance** help\n- **Why** a query is slow or **how to speed it up**\n- **Slow queries** on their cluster and\u002For **how to optimize them**\n- Index recommendations or index review\n\nDo **not** invoke for routine query authoring unless the user has requested help\nwith optimization, slow queries, or indexing.\n\n## High Level Workflow\n\n### Help with a Specific Query\n\nIf the user is asking about a particular query:\n\n1. Use `list_indexes` (MCP) or `db.\u003Ccoll>.getIndexes()` (mongosh) to get existing indexes on the collection\n2. Use `explain_operation` (MCP) or `.explain(\"executionStats\")` (mongosh)\n   to get explain output with execution stats\n3. Use `find_documents` (MCP) or `db.\u003Ccoll>.findOne()` (mongosh) to fetch a sample document to understand the\n   schema\n\nThen make an optimization suggestion based on collected information and best\npractices from the reference files. Prefer creating an index that fully covers\nthe query if possible.\n\n### General Performance Help\n\nIf the user wants to examine slow queries or is looking for general performance\nsuggestions (not regarding any particular query):\n\n1. Use `list_databases` (MCP) or `show dbs` (mongosh) to understand the database structure\n2. Use `get_statistics` with scope \"collection\" (MCP) or `db.collection.stats()` (mongosh) to identify large collections\n3. Use `get_statistics` with scope \"index\" (MCP) or `db.collection.aggregate([{$indexStats:{}}])` (mongosh) to check existing index usage\n4. Use `current_ops` (MCP) or `db.currentOp()` (mongosh) to see currently running operations\n5. Suggest reviewing the most-used collections for missing indexes\n\n## MCP Tools Available\n\nWhen DocumentDB MCP server is connected, these tools are available:\n\n| Tool name (exact) | Description |\n| :--- | :--- |\n| `list_indexes` | List all indexes on a collection — check if the query can use an existing index |\n| `explain_operation` | Run explain with executionStats for any operation (find, aggregate, count) |\n| `find_documents` | Fetch sample documents to understand schema — use with limit=1 |\n| `get_statistics` | Get collection or index statistics (use scope: \"collection\" or \"index\") |\n| `current_ops` | Get currently running database operations |\n| `create_index` | Create a new index (only after user approval) |\n| `drop_index` | Drop an existing index (only after user approval) |\n| `sample_documents` | Sample random documents from a collection |\n\n## Local mongosh Commands (No MCP Required)\n\nAll diagnostic operations can be performed directly via mongosh. Use these when\nMCP is not available or for quick ad-hoc diagnostics:\n\n```javascript\n\u002F\u002F Explain a find query\ndb.collection.find({filter}).explain(\"executionStats\")\n\n\u002F\u002F Explain an aggregation pipeline\ndb.collection.aggregate([{$match:...}, {$group:...}]).explain(\"executionStats\")\n\n\u002F\u002F Explain a count\ndb.runCommand({explain: {count: \"collection\", query: {filter}}, verbosity: \"executionStats\"})\n\n\u002F\u002F Collection statistics\ndb.collection.stats()\n\n\u002F\u002F List indexes\ndb.collection.getIndexes()\n\n\u002F\u002F Index usage statistics\ndb.collection.aggregate([{$indexStats: {}}])\n\n\u002F\u002F Sample documents\ndb.collection.aggregate([{$sample: {size: 3}}])\n\n\u002F\u002F Currently running operations\ndb.currentOp()\n```\n\n## Load References\n\nBefore beginning diagnosis and recommendation, load reference files.\n\nAlways load:\n\n- `references\u002Fcore-indexing-principles.md`\n\n## Diagnostic Workflow\n\n### Step 1: Gather Information\n\nFor a specific query, run these tools:\n\n**Via MCP (when connected):**\n```\nlist_indexes({ db_name: \"\u003Cdb>\", collection_name: \"\u003Ccoll>\" })\n```\n\n```\nexplain_operation({\n  db_name: \"\u003Cdb>\",\n  collection_name: \"\u003Ccoll>\",\n  operation: {\n    find: \"\u003Ccoll>\",\n    filter: \u003Cfilter>,\n    sort: \u003Csort>,\n    projection: \u003Cprojection>,\n    limit: \u003Cn>\n  }\n})\n```\n\nFor aggregation pipelines:\n```\nexplain_operation({\n  db_name: \"\u003Cdb>\",\n  collection_name: \"\u003Ccoll>\",\n  operation: {\n    aggregate: \"\u003Ccoll>\",\n    pipeline: \u003Cpipeline_array>,\n    cursor: {}\n  }\n})\n```\n\n**Via mongosh (no MCP):**\n```javascript\nuse \u003Cdb>\ndb.\u003Ccoll>.getIndexes()\ndb.\u003Ccoll>.find(\u003Cfilter>).sort(\u003Csort>).explain(\"executionStats\")\ndb.\u003Ccoll>.aggregate(\u003Cpipeline>).explain(\"executionStats\")\n```\n\n### Step 2: Analyze Explain Output\n\nFrom the `explain(\"executionStats\")` response (via MCP `explain_operation` or\ndirect mongosh), extract:\n\n- **metrics**: `totalKeysExamined`, `totalDocsExamined`, `nReturned`,\n  `executionTimeMillis`\n- **plan_shape**: winning plan stage (IXSCAN vs COLLSCAN), index used\n- **indexes_stats**: which indexes exist and their usage frequency\n- **collection_stats**: total document count, average document size\n\n**Key ratios to evaluate:**\n\n| Metric | Good | Bad |\n| :--- | :--- | :--- |\n| keysExamined \u002F nReturned | Close to 1 | >> 1 (poor selectivity) |\n| docsExamined \u002F nReturned | Close to 1 | >> 1 (scanning too many docs) |\n| Plan stage | IXSCAN | COLLSCAN (no index) |\n| Sort stage | In-memory: false | In-memory: true (blocking sort) |\n\n### Step 3: Diagnose\n\nCommon issues and their root causes:\n\n- **COLLSCAN** → No index supports the query filter. Create an index on\n  the filter fields.\n- **High keysExamined vs nReturned** → Index exists but has poor selectivity.\n  Consider a more selective compound index.\n- **In-memory sort** → Sort field is not indexed. Add sort field to the index\n  (after equality fields, before range fields).\n- **Large docsExamined** → Index doesn't cover the query. Consider a covering\n  index that includes projected fields.\n\n### Step 4: Recommend\n\nFollow the **ESR Rule** (Equality → Sort → Range) for compound index design:\n\n1. **Equality** fields first (fields with `$eq` \u002F exact match)\n2. **Sort** fields next (fields in the `sort` specification)\n3. **Range** fields last (fields with `$gt`, `$lt`, `$gte`, `$lte`, `$in`)\n\n**Example:**\nQuery: `db.orders.find({status: 'shipped', region: 'US'}).sort({date: -1})`\nRecommended index: `{status: 1, region: 1, date: -1}`\n(Two equality fields, then sort field)\n\n### Step 5: Verify (Optional)\n\nAfter creating the recommended index, re-run the explain to confirm improvement:\n\n1. Create the index (with user approval)\n2. Re-run `explain_operation` (MCP) or `.explain(\"executionStats\")` (mongosh) with the same query\n3. Compare metrics before and after\n\n## Example Workflow\n\n**User:** \"Why is this query slow?\n`db.orders.find({status: 'shipped', region: 'US'}).sort({date: -1})`\"\n\n**If MCP connection is available**, run steps 1–3:\n\n1. **Check existing indexes:**\n   - Call `list_indexes` with database=`store`, collection=`orders`\n   - Result shows: `{_id: 1}`, `{status: 1}`, `{date: -1}`\n\n2. **Run explain:**\n   - Call `explain_operation` with operation=`{find: \"orders\", filter: {status: \"shipped\", region: \"US\"}, sort: {date: -1}}`\n   - Result: Uses `{status: 1}` index, then in-memory SORT,\n     totalKeysExamined: 50000, nReturned: 100\n\n3. **Fetch sample:**\n   - Call `find_documents` with limit=1 to understand the schema\n\n**If MCP is not available**, use mongosh directly:\n\n```javascript\nuse store\ndb.orders.getIndexes()\ndb.orders.find({status: \"shipped\", region: \"US\"}).sort({date: -1}).explain(\"executionStats\")\ndb.orders.findOne()\n```\n\n4. **Diagnose:** This query targets 100 docs but scans 50K index entries (poor\n   selectivity: 0.002). In-memory sort adds overhead. The `{status: 1}` index\n   doesn't support both filter fields or sort.\n\n5. **Recommend:** Create compound index `{status: 1, region: 1, date: -1}`\n   following ESR (two equality fields, then sort). This eliminates in-memory\n   sort and improves selectivity.\n\n## Azure DocumentDB Specifics\n\n- **Index types supported**: Single field, compound, text, geospatial\n  (2dsphere), wildcard, unique\n- **Default _id index**: Every collection has an automatic `_id` index\n- **Compound index limit**: Check current Azure documentation for maximum\n  number of fields in a compound index\n- **Index builds**: Index creation on Azure DocumentDB may take time for large collections;\n  the operation runs in the background\n- **Covered queries**: Azure DocumentDB supports covered queries (index-only scans) when\n  all queried and projected fields are in the index\n- **Vector search**: Azure DocumentDB supports vector indexes (IVF, HNSW) for similarity\n  search. If IVF recall is poor, recommend switching to HNSW.\n\n## Output Format\n\n- Keep answers short and clear: a few sentences on index and optimization\n  suggestions, and reasoning behind them\n- Focus on highest-impact optimizations first\n- Do not use strong language like \"You should definitely create these indexes\"\n  — explain they are suggestions with reasoning\n- Consider how many indexes already exist — there shouldn't generally be\n  more than 20\n- Do not create or drop indexes directly via MCP unless the user gives approval\n- Present before\u002Fafter metrics when possible\n\n## Safety Rules\n\n- **NEVER create or drop indexes without explicit user approval**\n- Always explain what the index change will do and why before asking for\n  approval\n- If the collection has many existing indexes (>15), warn about the overhead of\n  adding more\n- For drop recommendations, explain the impact on other queries that may use\n  the index\n",{"data":39,"body":41},{"name":4,"description":6,"allowed-tools":40},"mcp__documentdb__*",{"type":42,"children":43},"root",[44,52,59,73,131,143,149,156,161,225,230,236,241,326,332,337,497,503,508,1148,1154,1159,1164,1176,1182,1188,1193,1201,1211,1220,1225,1234,1242,1406,1412,1432,1504,1512,1610,1616,1621,1664,1670,1682,1765,1791,1797,1802,1833,1839,1855,1865,1992,2002,2230,2267,2273,2344,2350,2383,2389,2415],{"type":45,"tag":46,"props":47,"children":48},"element","h1",{"id":4},[49],{"type":50,"value":51},"text","DocumentDB Query Optimizer",{"type":45,"tag":53,"props":54,"children":56},"h2",{"id":55},"when-this-skill-is-invoked",[57],{"type":50,"value":58},"When This Skill Is Invoked",{"type":45,"tag":60,"props":61,"children":62},"p",{},[63,65,71],{"type":50,"value":64},"Invoke ",{"type":45,"tag":66,"props":67,"children":68},"strong",{},[69],{"type":50,"value":70},"only",{"type":50,"value":72}," when the user wants:",{"type":45,"tag":74,"props":75,"children":76},"ul",{},[77,96,111,126],{"type":45,"tag":78,"props":79,"children":80},"li",{},[81,83,88,90,94],{"type":50,"value":82},"Query\u002Findex ",{"type":45,"tag":66,"props":84,"children":85},{},[86],{"type":50,"value":87},"optimization",{"type":50,"value":89}," or ",{"type":45,"tag":66,"props":91,"children":92},{},[93],{"type":50,"value":15},{"type":50,"value":95}," help",{"type":45,"tag":78,"props":97,"children":98},{},[99,104,106],{"type":45,"tag":66,"props":100,"children":101},{},[102],{"type":50,"value":103},"Why",{"type":50,"value":105}," a query is slow or ",{"type":45,"tag":66,"props":107,"children":108},{},[109],{"type":50,"value":110},"how to speed it up",{"type":45,"tag":78,"props":112,"children":113},{},[114,119,121],{"type":45,"tag":66,"props":115,"children":116},{},[117],{"type":50,"value":118},"Slow queries",{"type":50,"value":120}," on their cluster and\u002For ",{"type":45,"tag":66,"props":122,"children":123},{},[124],{"type":50,"value":125},"how to optimize them",{"type":45,"tag":78,"props":127,"children":128},{},[129],{"type":50,"value":130},"Index recommendations or index review",{"type":45,"tag":60,"props":132,"children":133},{},[134,136,141],{"type":50,"value":135},"Do ",{"type":45,"tag":66,"props":137,"children":138},{},[139],{"type":50,"value":140},"not",{"type":50,"value":142}," invoke for routine query authoring unless the user has requested help\nwith optimization, slow queries, or indexing.",{"type":45,"tag":53,"props":144,"children":146},{"id":145},"high-level-workflow",[147],{"type":50,"value":148},"High Level Workflow",{"type":45,"tag":150,"props":151,"children":153},"h3",{"id":152},"help-with-a-specific-query",[154],{"type":50,"value":155},"Help with a Specific Query",{"type":45,"tag":60,"props":157,"children":158},{},[159],{"type":50,"value":160},"If the user is asking about a particular query:",{"type":45,"tag":162,"props":163,"children":164},"ol",{},[165,187,206],{"type":45,"tag":78,"props":166,"children":167},{},[168,170,177,179,185],{"type":50,"value":169},"Use ",{"type":45,"tag":171,"props":172,"children":174},"code",{"className":173},[],[175],{"type":50,"value":176},"list_indexes",{"type":50,"value":178}," (MCP) or ",{"type":45,"tag":171,"props":180,"children":182},{"className":181},[],[183],{"type":50,"value":184},"db.\u003Ccoll>.getIndexes()",{"type":50,"value":186}," (mongosh) to get existing indexes on the collection",{"type":45,"tag":78,"props":188,"children":189},{},[190,191,197,198,204],{"type":50,"value":169},{"type":45,"tag":171,"props":192,"children":194},{"className":193},[],[195],{"type":50,"value":196},"explain_operation",{"type":50,"value":178},{"type":45,"tag":171,"props":199,"children":201},{"className":200},[],[202],{"type":50,"value":203},".explain(\"executionStats\")",{"type":50,"value":205}," (mongosh)\nto get explain output with execution stats",{"type":45,"tag":78,"props":207,"children":208},{},[209,210,216,217,223],{"type":50,"value":169},{"type":45,"tag":171,"props":211,"children":213},{"className":212},[],[214],{"type":50,"value":215},"find_documents",{"type":50,"value":178},{"type":45,"tag":171,"props":218,"children":220},{"className":219},[],[221],{"type":50,"value":222},"db.\u003Ccoll>.findOne()",{"type":50,"value":224}," (mongosh) to fetch a sample document to understand the\nschema",{"type":45,"tag":60,"props":226,"children":227},{},[228],{"type":50,"value":229},"Then make an optimization suggestion based on collected information and best\npractices from the reference files. Prefer creating an index that fully covers\nthe query if possible.",{"type":45,"tag":150,"props":231,"children":233},{"id":232},"general-performance-help",[234],{"type":50,"value":235},"General Performance Help",{"type":45,"tag":60,"props":237,"children":238},{},[239],{"type":50,"value":240},"If the user wants to examine slow queries or is looking for general performance\nsuggestions (not regarding any particular query):",{"type":45,"tag":162,"props":242,"children":243},{},[244,263,283,302,321],{"type":45,"tag":78,"props":245,"children":246},{},[247,248,254,255,261],{"type":50,"value":169},{"type":45,"tag":171,"props":249,"children":251},{"className":250},[],[252],{"type":50,"value":253},"list_databases",{"type":50,"value":178},{"type":45,"tag":171,"props":256,"children":258},{"className":257},[],[259],{"type":50,"value":260},"show dbs",{"type":50,"value":262}," (mongosh) to understand the database structure",{"type":45,"tag":78,"props":264,"children":265},{},[266,267,273,275,281],{"type":50,"value":169},{"type":45,"tag":171,"props":268,"children":270},{"className":269},[],[271],{"type":50,"value":272},"get_statistics",{"type":50,"value":274}," with scope \"collection\" (MCP) or ",{"type":45,"tag":171,"props":276,"children":278},{"className":277},[],[279],{"type":50,"value":280},"db.collection.stats()",{"type":50,"value":282}," (mongosh) to identify large collections",{"type":45,"tag":78,"props":284,"children":285},{},[286,287,292,294,300],{"type":50,"value":169},{"type":45,"tag":171,"props":288,"children":290},{"className":289},[],[291],{"type":50,"value":272},{"type":50,"value":293}," with scope \"index\" (MCP) or ",{"type":45,"tag":171,"props":295,"children":297},{"className":296},[],[298],{"type":50,"value":299},"db.collection.aggregate([{$indexStats:{}}])",{"type":50,"value":301}," (mongosh) to check existing index usage",{"type":45,"tag":78,"props":303,"children":304},{},[305,306,312,313,319],{"type":50,"value":169},{"type":45,"tag":171,"props":307,"children":309},{"className":308},[],[310],{"type":50,"value":311},"current_ops",{"type":50,"value":178},{"type":45,"tag":171,"props":314,"children":316},{"className":315},[],[317],{"type":50,"value":318},"db.currentOp()",{"type":50,"value":320}," (mongosh) to see currently running operations",{"type":45,"tag":78,"props":322,"children":323},{},[324],{"type":50,"value":325},"Suggest reviewing the most-used collections for missing indexes",{"type":45,"tag":53,"props":327,"children":329},{"id":328},"mcp-tools-available",[330],{"type":50,"value":331},"MCP Tools Available",{"type":45,"tag":60,"props":333,"children":334},{},[335],{"type":50,"value":336},"When DocumentDB MCP server is connected, these tools are available:",{"type":45,"tag":338,"props":339,"children":340},"table",{},[341,361],{"type":45,"tag":342,"props":343,"children":344},"thead",{},[345],{"type":45,"tag":346,"props":347,"children":348},"tr",{},[349,356],{"type":45,"tag":350,"props":351,"children":353},"th",{"align":352},"left",[354],{"type":50,"value":355},"Tool name (exact)",{"type":45,"tag":350,"props":357,"children":358},{"align":352},[359],{"type":50,"value":360},"Description",{"type":45,"tag":362,"props":363,"children":364},"tbody",{},[365,382,398,414,430,446,463,480],{"type":45,"tag":346,"props":366,"children":367},{},[368,377],{"type":45,"tag":369,"props":370,"children":371},"td",{"align":352},[372],{"type":45,"tag":171,"props":373,"children":375},{"className":374},[],[376],{"type":50,"value":176},{"type":45,"tag":369,"props":378,"children":379},{"align":352},[380],{"type":50,"value":381},"List all indexes on a collection — check if the query can use an existing index",{"type":45,"tag":346,"props":383,"children":384},{},[385,393],{"type":45,"tag":369,"props":386,"children":387},{"align":352},[388],{"type":45,"tag":171,"props":389,"children":391},{"className":390},[],[392],{"type":50,"value":196},{"type":45,"tag":369,"props":394,"children":395},{"align":352},[396],{"type":50,"value":397},"Run explain with executionStats for any operation (find, aggregate, count)",{"type":45,"tag":346,"props":399,"children":400},{},[401,409],{"type":45,"tag":369,"props":402,"children":403},{"align":352},[404],{"type":45,"tag":171,"props":405,"children":407},{"className":406},[],[408],{"type":50,"value":215},{"type":45,"tag":369,"props":410,"children":411},{"align":352},[412],{"type":50,"value":413},"Fetch sample documents to understand schema — use with limit=1",{"type":45,"tag":346,"props":415,"children":416},{},[417,425],{"type":45,"tag":369,"props":418,"children":419},{"align":352},[420],{"type":45,"tag":171,"props":421,"children":423},{"className":422},[],[424],{"type":50,"value":272},{"type":45,"tag":369,"props":426,"children":427},{"align":352},[428],{"type":50,"value":429},"Get collection or index statistics (use scope: \"collection\" or \"index\")",{"type":45,"tag":346,"props":431,"children":432},{},[433,441],{"type":45,"tag":369,"props":434,"children":435},{"align":352},[436],{"type":45,"tag":171,"props":437,"children":439},{"className":438},[],[440],{"type":50,"value":311},{"type":45,"tag":369,"props":442,"children":443},{"align":352},[444],{"type":50,"value":445},"Get currently running database operations",{"type":45,"tag":346,"props":447,"children":448},{},[449,458],{"type":45,"tag":369,"props":450,"children":451},{"align":352},[452],{"type":45,"tag":171,"props":453,"children":455},{"className":454},[],[456],{"type":50,"value":457},"create_index",{"type":45,"tag":369,"props":459,"children":460},{"align":352},[461],{"type":50,"value":462},"Create a new index (only after user approval)",{"type":45,"tag":346,"props":464,"children":465},{},[466,475],{"type":45,"tag":369,"props":467,"children":468},{"align":352},[469],{"type":45,"tag":171,"props":470,"children":472},{"className":471},[],[473],{"type":50,"value":474},"drop_index",{"type":45,"tag":369,"props":476,"children":477},{"align":352},[478],{"type":50,"value":479},"Drop an existing index (only after user approval)",{"type":45,"tag":346,"props":481,"children":482},{},[483,492],{"type":45,"tag":369,"props":484,"children":485},{"align":352},[486],{"type":45,"tag":171,"props":487,"children":489},{"className":488},[],[490],{"type":50,"value":491},"sample_documents",{"type":45,"tag":369,"props":493,"children":494},{"align":352},[495],{"type":50,"value":496},"Sample random documents from a collection",{"type":45,"tag":53,"props":498,"children":500},{"id":499},"local-mongosh-commands-no-mcp-required",[501],{"type":50,"value":502},"Local mongosh Commands (No MCP Required)",{"type":45,"tag":60,"props":504,"children":505},{},[506],{"type":50,"value":507},"All diagnostic operations can be performed directly via mongosh. Use these when\nMCP is not available or for quick ad-hoc diagnostics:",{"type":45,"tag":509,"props":510,"children":515},"pre",{"className":511,"code":512,"language":513,"meta":514,"style":514},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Explain a find query\ndb.collection.find({filter}).explain(\"executionStats\")\n\n\u002F\u002F Explain an aggregation pipeline\ndb.collection.aggregate([{$match:...}, {$group:...}]).explain(\"executionStats\")\n\n\u002F\u002F Explain a count\ndb.runCommand({explain: {count: \"collection\", query: {filter}}, verbosity: \"executionStats\"})\n\n\u002F\u002F Collection statistics\ndb.collection.stats()\n\n\u002F\u002F List indexes\ndb.collection.getIndexes()\n\n\u002F\u002F Index usage statistics\ndb.collection.aggregate([{$indexStats: {}}])\n\n\u002F\u002F Sample documents\ndb.collection.aggregate([{$sample: {size: 3}}])\n\n\u002F\u002F Currently running operations\ndb.currentOp()\n","javascript","",[516],{"type":45,"tag":171,"props":517,"children":518},{"__ignoreMap":514},[519,531,620,630,639,731,739,747,863,871,880,910,918,927,956,964,973,1024,1032,1041,1110,1118,1127],{"type":45,"tag":520,"props":521,"children":524},"span",{"class":522,"line":523},"line",1,[525],{"type":45,"tag":520,"props":526,"children":528},{"style":527},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[529],{"type":50,"value":530},"\u002F\u002F Explain a find query\n",{"type":45,"tag":520,"props":532,"children":534},{"class":522,"line":533},2,[535,541,547,552,556,562,567,572,577,582,587,591,596,600,605,611,615],{"type":45,"tag":520,"props":536,"children":538},{"style":537},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[539],{"type":50,"value":540},"db",{"type":45,"tag":520,"props":542,"children":544},{"style":543},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[545],{"type":50,"value":546},".",{"type":45,"tag":520,"props":548,"children":549},{"style":537},[550],{"type":50,"value":551},"collection",{"type":45,"tag":520,"props":553,"children":554},{"style":543},[555],{"type":50,"value":546},{"type":45,"tag":520,"props":557,"children":559},{"style":558},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[560],{"type":50,"value":561},"find",{"type":45,"tag":520,"props":563,"children":564},{"style":537},[565],{"type":50,"value":566},"(",{"type":45,"tag":520,"props":568,"children":569},{"style":543},[570],{"type":50,"value":571},"{",{"type":45,"tag":520,"props":573,"children":574},{"style":537},[575],{"type":50,"value":576},"filter",{"type":45,"tag":520,"props":578,"children":579},{"style":543},[580],{"type":50,"value":581},"}",{"type":45,"tag":520,"props":583,"children":584},{"style":537},[585],{"type":50,"value":586},")",{"type":45,"tag":520,"props":588,"children":589},{"style":543},[590],{"type":50,"value":546},{"type":45,"tag":520,"props":592,"children":593},{"style":558},[594],{"type":50,"value":595},"explain",{"type":45,"tag":520,"props":597,"children":598},{"style":537},[599],{"type":50,"value":566},{"type":45,"tag":520,"props":601,"children":602},{"style":543},[603],{"type":50,"value":604},"\"",{"type":45,"tag":520,"props":606,"children":608},{"style":607},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[609],{"type":50,"value":610},"executionStats",{"type":45,"tag":520,"props":612,"children":613},{"style":543},[614],{"type":50,"value":604},{"type":45,"tag":520,"props":616,"children":617},{"style":537},[618],{"type":50,"value":619},")\n",{"type":45,"tag":520,"props":621,"children":623},{"class":522,"line":622},3,[624],{"type":45,"tag":520,"props":625,"children":627},{"emptyLinePlaceholder":626},true,[628],{"type":50,"value":629},"\n",{"type":45,"tag":520,"props":631,"children":633},{"class":522,"line":632},4,[634],{"type":45,"tag":520,"props":635,"children":636},{"style":527},[637],{"type":50,"value":638},"\u002F\u002F Explain an aggregation pipeline\n",{"type":45,"tag":520,"props":640,"children":641},{"class":522,"line":27},[642,646,650,654,658,663,668,672,678,683,688,693,698,703,707,711,715,719,723,727],{"type":45,"tag":520,"props":643,"children":644},{"style":537},[645],{"type":50,"value":540},{"type":45,"tag":520,"props":647,"children":648},{"style":543},[649],{"type":50,"value":546},{"type":45,"tag":520,"props":651,"children":652},{"style":537},[653],{"type":50,"value":551},{"type":45,"tag":520,"props":655,"children":656},{"style":543},[657],{"type":50,"value":546},{"type":45,"tag":520,"props":659,"children":660},{"style":558},[661],{"type":50,"value":662},"aggregate",{"type":45,"tag":520,"props":664,"children":665},{"style":537},[666],{"type":50,"value":667},"([",{"type":45,"tag":520,"props":669,"children":670},{"style":543},[671],{"type":50,"value":571},{"type":45,"tag":520,"props":673,"children":675},{"style":674},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[676],{"type":50,"value":677},"$match",{"type":45,"tag":520,"props":679,"children":680},{"style":543},[681],{"type":50,"value":682},":...},",{"type":45,"tag":520,"props":684,"children":685},{"style":543},[686],{"type":50,"value":687}," {",{"type":45,"tag":520,"props":689,"children":690},{"style":674},[691],{"type":50,"value":692},"$group",{"type":45,"tag":520,"props":694,"children":695},{"style":543},[696],{"type":50,"value":697},":...}",{"type":45,"tag":520,"props":699,"children":700},{"style":537},[701],{"type":50,"value":702},"])",{"type":45,"tag":520,"props":704,"children":705},{"style":543},[706],{"type":50,"value":546},{"type":45,"tag":520,"props":708,"children":709},{"style":558},[710],{"type":50,"value":595},{"type":45,"tag":520,"props":712,"children":713},{"style":537},[714],{"type":50,"value":566},{"type":45,"tag":520,"props":716,"children":717},{"style":543},[718],{"type":50,"value":604},{"type":45,"tag":520,"props":720,"children":721},{"style":607},[722],{"type":50,"value":610},{"type":45,"tag":520,"props":724,"children":725},{"style":543},[726],{"type":50,"value":604},{"type":45,"tag":520,"props":728,"children":729},{"style":537},[730],{"type":50,"value":619},{"type":45,"tag":520,"props":732,"children":734},{"class":522,"line":733},6,[735],{"type":45,"tag":520,"props":736,"children":737},{"emptyLinePlaceholder":626},[738],{"type":50,"value":629},{"type":45,"tag":520,"props":740,"children":741},{"class":522,"line":31},[742],{"type":45,"tag":520,"props":743,"children":744},{"style":527},[745],{"type":50,"value":746},"\u002F\u002F Explain a count\n",{"type":45,"tag":520,"props":748,"children":750},{"class":522,"line":749},8,[751,755,759,764,768,772,776,781,785,790,794,799,803,807,812,817,821,825,829,834,839,843,847,851,855,859],{"type":45,"tag":520,"props":752,"children":753},{"style":537},[754],{"type":50,"value":540},{"type":45,"tag":520,"props":756,"children":757},{"style":543},[758],{"type":50,"value":546},{"type":45,"tag":520,"props":760,"children":761},{"style":558},[762],{"type":50,"value":763},"runCommand",{"type":45,"tag":520,"props":765,"children":766},{"style":537},[767],{"type":50,"value":566},{"type":45,"tag":520,"props":769,"children":770},{"style":543},[771],{"type":50,"value":571},{"type":45,"tag":520,"props":773,"children":774},{"style":674},[775],{"type":50,"value":595},{"type":45,"tag":520,"props":777,"children":778},{"style":543},[779],{"type":50,"value":780},":",{"type":45,"tag":520,"props":782,"children":783},{"style":543},[784],{"type":50,"value":687},{"type":45,"tag":520,"props":786,"children":787},{"style":674},[788],{"type":50,"value":789},"count",{"type":45,"tag":520,"props":791,"children":792},{"style":543},[793],{"type":50,"value":780},{"type":45,"tag":520,"props":795,"children":796},{"style":543},[797],{"type":50,"value":798}," \"",{"type":45,"tag":520,"props":800,"children":801},{"style":607},[802],{"type":50,"value":551},{"type":45,"tag":520,"props":804,"children":805},{"style":543},[806],{"type":50,"value":604},{"type":45,"tag":520,"props":808,"children":809},{"style":543},[810],{"type":50,"value":811},",",{"type":45,"tag":520,"props":813,"children":814},{"style":674},[815],{"type":50,"value":816}," query",{"type":45,"tag":520,"props":818,"children":819},{"style":543},[820],{"type":50,"value":780},{"type":45,"tag":520,"props":822,"children":823},{"style":543},[824],{"type":50,"value":687},{"type":45,"tag":520,"props":826,"children":827},{"style":537},[828],{"type":50,"value":576},{"type":45,"tag":520,"props":830,"children":831},{"style":543},[832],{"type":50,"value":833},"}},",{"type":45,"tag":520,"props":835,"children":836},{"style":674},[837],{"type":50,"value":838}," verbosity",{"type":45,"tag":520,"props":840,"children":841},{"style":543},[842],{"type":50,"value":780},{"type":45,"tag":520,"props":844,"children":845},{"style":543},[846],{"type":50,"value":798},{"type":45,"tag":520,"props":848,"children":849},{"style":607},[850],{"type":50,"value":610},{"type":45,"tag":520,"props":852,"children":853},{"style":543},[854],{"type":50,"value":604},{"type":45,"tag":520,"props":856,"children":857},{"style":543},[858],{"type":50,"value":581},{"type":45,"tag":520,"props":860,"children":861},{"style":537},[862],{"type":50,"value":619},{"type":45,"tag":520,"props":864,"children":866},{"class":522,"line":865},9,[867],{"type":45,"tag":520,"props":868,"children":869},{"emptyLinePlaceholder":626},[870],{"type":50,"value":629},{"type":45,"tag":520,"props":872,"children":874},{"class":522,"line":873},10,[875],{"type":45,"tag":520,"props":876,"children":877},{"style":527},[878],{"type":50,"value":879},"\u002F\u002F Collection statistics\n",{"type":45,"tag":520,"props":881,"children":883},{"class":522,"line":882},11,[884,888,892,896,900,905],{"type":45,"tag":520,"props":885,"children":886},{"style":537},[887],{"type":50,"value":540},{"type":45,"tag":520,"props":889,"children":890},{"style":543},[891],{"type":50,"value":546},{"type":45,"tag":520,"props":893,"children":894},{"style":537},[895],{"type":50,"value":551},{"type":45,"tag":520,"props":897,"children":898},{"style":543},[899],{"type":50,"value":546},{"type":45,"tag":520,"props":901,"children":902},{"style":558},[903],{"type":50,"value":904},"stats",{"type":45,"tag":520,"props":906,"children":907},{"style":537},[908],{"type":50,"value":909},"()\n",{"type":45,"tag":520,"props":911,"children":913},{"class":522,"line":912},12,[914],{"type":45,"tag":520,"props":915,"children":916},{"emptyLinePlaceholder":626},[917],{"type":50,"value":629},{"type":45,"tag":520,"props":919,"children":921},{"class":522,"line":920},13,[922],{"type":45,"tag":520,"props":923,"children":924},{"style":527},[925],{"type":50,"value":926},"\u002F\u002F List indexes\n",{"type":45,"tag":520,"props":928,"children":930},{"class":522,"line":929},14,[931,935,939,943,947,952],{"type":45,"tag":520,"props":932,"children":933},{"style":537},[934],{"type":50,"value":540},{"type":45,"tag":520,"props":936,"children":937},{"style":543},[938],{"type":50,"value":546},{"type":45,"tag":520,"props":940,"children":941},{"style":537},[942],{"type":50,"value":551},{"type":45,"tag":520,"props":944,"children":945},{"style":543},[946],{"type":50,"value":546},{"type":45,"tag":520,"props":948,"children":949},{"style":558},[950],{"type":50,"value":951},"getIndexes",{"type":45,"tag":520,"props":953,"children":954},{"style":537},[955],{"type":50,"value":909},{"type":45,"tag":520,"props":957,"children":959},{"class":522,"line":958},15,[960],{"type":45,"tag":520,"props":961,"children":962},{"emptyLinePlaceholder":626},[963],{"type":50,"value":629},{"type":45,"tag":520,"props":965,"children":967},{"class":522,"line":966},16,[968],{"type":45,"tag":520,"props":969,"children":970},{"style":527},[971],{"type":50,"value":972},"\u002F\u002F Index usage statistics\n",{"type":45,"tag":520,"props":974,"children":976},{"class":522,"line":975},17,[977,981,985,989,993,997,1001,1005,1010,1014,1019],{"type":45,"tag":520,"props":978,"children":979},{"style":537},[980],{"type":50,"value":540},{"type":45,"tag":520,"props":982,"children":983},{"style":543},[984],{"type":50,"value":546},{"type":45,"tag":520,"props":986,"children":987},{"style":537},[988],{"type":50,"value":551},{"type":45,"tag":520,"props":990,"children":991},{"style":543},[992],{"type":50,"value":546},{"type":45,"tag":520,"props":994,"children":995},{"style":558},[996],{"type":50,"value":662},{"type":45,"tag":520,"props":998,"children":999},{"style":537},[1000],{"type":50,"value":667},{"type":45,"tag":520,"props":1002,"children":1003},{"style":543},[1004],{"type":50,"value":571},{"type":45,"tag":520,"props":1006,"children":1007},{"style":674},[1008],{"type":50,"value":1009},"$indexStats",{"type":45,"tag":520,"props":1011,"children":1012},{"style":543},[1013],{"type":50,"value":780},{"type":45,"tag":520,"props":1015,"children":1016},{"style":543},[1017],{"type":50,"value":1018}," {}}",{"type":45,"tag":520,"props":1020,"children":1021},{"style":537},[1022],{"type":50,"value":1023},"])\n",{"type":45,"tag":520,"props":1025,"children":1027},{"class":522,"line":1026},18,[1028],{"type":45,"tag":520,"props":1029,"children":1030},{"emptyLinePlaceholder":626},[1031],{"type":50,"value":629},{"type":45,"tag":520,"props":1033,"children":1035},{"class":522,"line":1034},19,[1036],{"type":45,"tag":520,"props":1037,"children":1038},{"style":527},[1039],{"type":50,"value":1040},"\u002F\u002F Sample documents\n",{"type":45,"tag":520,"props":1042,"children":1044},{"class":522,"line":1043},20,[1045,1049,1053,1057,1061,1065,1069,1073,1078,1082,1086,1091,1095,1101,1106],{"type":45,"tag":520,"props":1046,"children":1047},{"style":537},[1048],{"type":50,"value":540},{"type":45,"tag":520,"props":1050,"children":1051},{"style":543},[1052],{"type":50,"value":546},{"type":45,"tag":520,"props":1054,"children":1055},{"style":537},[1056],{"type":50,"value":551},{"type":45,"tag":520,"props":1058,"children":1059},{"style":543},[1060],{"type":50,"value":546},{"type":45,"tag":520,"props":1062,"children":1063},{"style":558},[1064],{"type":50,"value":662},{"type":45,"tag":520,"props":1066,"children":1067},{"style":537},[1068],{"type":50,"value":667},{"type":45,"tag":520,"props":1070,"children":1071},{"style":543},[1072],{"type":50,"value":571},{"type":45,"tag":520,"props":1074,"children":1075},{"style":674},[1076],{"type":50,"value":1077},"$sample",{"type":45,"tag":520,"props":1079,"children":1080},{"style":543},[1081],{"type":50,"value":780},{"type":45,"tag":520,"props":1083,"children":1084},{"style":543},[1085],{"type":50,"value":687},{"type":45,"tag":520,"props":1087,"children":1088},{"style":674},[1089],{"type":50,"value":1090},"size",{"type":45,"tag":520,"props":1092,"children":1093},{"style":543},[1094],{"type":50,"value":780},{"type":45,"tag":520,"props":1096,"children":1098},{"style":1097},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1099],{"type":50,"value":1100}," 3",{"type":45,"tag":520,"props":1102,"children":1103},{"style":543},[1104],{"type":50,"value":1105},"}}",{"type":45,"tag":520,"props":1107,"children":1108},{"style":537},[1109],{"type":50,"value":1023},{"type":45,"tag":520,"props":1111,"children":1113},{"class":522,"line":1112},21,[1114],{"type":45,"tag":520,"props":1115,"children":1116},{"emptyLinePlaceholder":626},[1117],{"type":50,"value":629},{"type":45,"tag":520,"props":1119,"children":1121},{"class":522,"line":1120},22,[1122],{"type":45,"tag":520,"props":1123,"children":1124},{"style":527},[1125],{"type":50,"value":1126},"\u002F\u002F Currently running operations\n",{"type":45,"tag":520,"props":1128,"children":1130},{"class":522,"line":1129},23,[1131,1135,1139,1144],{"type":45,"tag":520,"props":1132,"children":1133},{"style":537},[1134],{"type":50,"value":540},{"type":45,"tag":520,"props":1136,"children":1137},{"style":543},[1138],{"type":50,"value":546},{"type":45,"tag":520,"props":1140,"children":1141},{"style":558},[1142],{"type":50,"value":1143},"currentOp",{"type":45,"tag":520,"props":1145,"children":1146},{"style":537},[1147],{"type":50,"value":909},{"type":45,"tag":53,"props":1149,"children":1151},{"id":1150},"load-references",[1152],{"type":50,"value":1153},"Load References",{"type":45,"tag":60,"props":1155,"children":1156},{},[1157],{"type":50,"value":1158},"Before beginning diagnosis and recommendation, load reference files.",{"type":45,"tag":60,"props":1160,"children":1161},{},[1162],{"type":50,"value":1163},"Always load:",{"type":45,"tag":74,"props":1165,"children":1166},{},[1167],{"type":45,"tag":78,"props":1168,"children":1169},{},[1170],{"type":45,"tag":171,"props":1171,"children":1173},{"className":1172},[],[1174],{"type":50,"value":1175},"references\u002Fcore-indexing-principles.md",{"type":45,"tag":53,"props":1177,"children":1179},{"id":1178},"diagnostic-workflow",[1180],{"type":50,"value":1181},"Diagnostic Workflow",{"type":45,"tag":150,"props":1183,"children":1185},{"id":1184},"step-1-gather-information",[1186],{"type":50,"value":1187},"Step 1: Gather Information",{"type":45,"tag":60,"props":1189,"children":1190},{},[1191],{"type":50,"value":1192},"For a specific query, run these tools:",{"type":45,"tag":60,"props":1194,"children":1195},{},[1196],{"type":45,"tag":66,"props":1197,"children":1198},{},[1199],{"type":50,"value":1200},"Via MCP (when connected):",{"type":45,"tag":509,"props":1202,"children":1206},{"className":1203,"code":1205,"language":50},[1204],"language-text","list_indexes({ db_name: \"\u003Cdb>\", collection_name: \"\u003Ccoll>\" })\n",[1207],{"type":45,"tag":171,"props":1208,"children":1209},{"__ignoreMap":514},[1210],{"type":50,"value":1205},{"type":45,"tag":509,"props":1212,"children":1215},{"className":1213,"code":1214,"language":50},[1204],"explain_operation({\n  db_name: \"\u003Cdb>\",\n  collection_name: \"\u003Ccoll>\",\n  operation: {\n    find: \"\u003Ccoll>\",\n    filter: \u003Cfilter>,\n    sort: \u003Csort>,\n    projection: \u003Cprojection>,\n    limit: \u003Cn>\n  }\n})\n",[1216],{"type":45,"tag":171,"props":1217,"children":1218},{"__ignoreMap":514},[1219],{"type":50,"value":1214},{"type":45,"tag":60,"props":1221,"children":1222},{},[1223],{"type":50,"value":1224},"For aggregation pipelines:",{"type":45,"tag":509,"props":1226,"children":1229},{"className":1227,"code":1228,"language":50},[1204],"explain_operation({\n  db_name: \"\u003Cdb>\",\n  collection_name: \"\u003Ccoll>\",\n  operation: {\n    aggregate: \"\u003Ccoll>\",\n    pipeline: \u003Cpipeline_array>,\n    cursor: {}\n  }\n})\n",[1230],{"type":45,"tag":171,"props":1231,"children":1232},{"__ignoreMap":514},[1233],{"type":50,"value":1228},{"type":45,"tag":60,"props":1235,"children":1236},{},[1237],{"type":45,"tag":66,"props":1238,"children":1239},{},[1240],{"type":50,"value":1241},"Via mongosh (no MCP):",{"type":45,"tag":509,"props":1243,"children":1245},{"className":511,"code":1244,"language":513,"meta":514,"style":514},"use \u003Cdb>\ndb.\u003Ccoll>.getIndexes()\ndb.\u003Ccoll>.find(\u003Cfilter>).sort(\u003Csort>).explain(\"executionStats\")\ndb.\u003Ccoll>.aggregate(\u003Cpipeline>).explain(\"executionStats\")\n",[1246],{"type":45,"tag":171,"props":1247,"children":1248},{"__ignoreMap":514},[1249,1271,1301,1364],{"type":45,"tag":520,"props":1250,"children":1251},{"class":522,"line":523},[1252,1257,1262,1266],{"type":45,"tag":520,"props":1253,"children":1254},{"style":537},[1255],{"type":50,"value":1256},"use ",{"type":45,"tag":520,"props":1258,"children":1259},{"style":543},[1260],{"type":50,"value":1261},"\u003C",{"type":45,"tag":520,"props":1263,"children":1264},{"style":537},[1265],{"type":50,"value":540},{"type":45,"tag":520,"props":1267,"children":1268},{"style":543},[1269],{"type":50,"value":1270},">\n",{"type":45,"tag":520,"props":1272,"children":1273},{"class":522,"line":533},[1274,1278,1283,1288,1293,1297],{"type":45,"tag":520,"props":1275,"children":1276},{"style":537},[1277],{"type":50,"value":540},{"type":45,"tag":520,"props":1279,"children":1280},{"style":543},[1281],{"type":50,"value":1282},".\u003C",{"type":45,"tag":520,"props":1284,"children":1285},{"style":537},[1286],{"type":50,"value":1287},"coll",{"type":45,"tag":520,"props":1289,"children":1290},{"style":543},[1291],{"type":50,"value":1292},">.",{"type":45,"tag":520,"props":1294,"children":1295},{"style":558},[1296],{"type":50,"value":951},{"type":45,"tag":520,"props":1298,"children":1299},{"style":537},[1300],{"type":50,"value":909},{"type":45,"tag":520,"props":1302,"children":1303},{"class":522,"line":622},[1304,1308,1312,1316,1320,1324,1328,1332,1336,1341,1346,1350,1355,1359],{"type":45,"tag":520,"props":1305,"children":1306},{"style":537},[1307],{"type":50,"value":540},{"type":45,"tag":520,"props":1309,"children":1310},{"style":543},[1311],{"type":50,"value":1282},{"type":45,"tag":520,"props":1313,"children":1314},{"style":537},[1315],{"type":50,"value":1287},{"type":45,"tag":520,"props":1317,"children":1318},{"style":543},[1319],{"type":50,"value":1292},{"type":45,"tag":520,"props":1321,"children":1322},{"style":558},[1323],{"type":50,"value":561},{"type":45,"tag":520,"props":1325,"children":1326},{"style":537},[1327],{"type":50,"value":566},{"type":45,"tag":520,"props":1329,"children":1330},{"style":543},[1331],{"type":50,"value":1261},{"type":45,"tag":520,"props":1333,"children":1334},{"style":674},[1335],{"type":50,"value":576},{"type":45,"tag":520,"props":1337,"children":1338},{"style":543},[1339],{"type":50,"value":1340},">",{"type":45,"tag":520,"props":1342,"children":1343},{"style":537},[1344],{"type":50,"value":1345},").sort(",{"type":45,"tag":520,"props":1347,"children":1348},{"style":543},[1349],{"type":50,"value":1261},{"type":45,"tag":520,"props":1351,"children":1352},{"style":674},[1353],{"type":50,"value":1354},"sort",{"type":45,"tag":520,"props":1356,"children":1357},{"style":543},[1358],{"type":50,"value":1340},{"type":45,"tag":520,"props":1360,"children":1361},{"style":537},[1362],{"type":50,"value":1363},").explain(\"executionStats\")\n",{"type":45,"tag":520,"props":1365,"children":1366},{"class":522,"line":632},[1367,1372,1376,1380,1384,1389,1393,1398,1402],{"type":45,"tag":520,"props":1368,"children":1369},{"style":537},[1370],{"type":50,"value":1371},"db.",{"type":45,"tag":520,"props":1373,"children":1374},{"style":543},[1375],{"type":50,"value":1261},{"type":45,"tag":520,"props":1377,"children":1378},{"style":674},[1379],{"type":50,"value":1287},{"type":45,"tag":520,"props":1381,"children":1382},{"style":543},[1383],{"type":50,"value":1340},{"type":45,"tag":520,"props":1385,"children":1386},{"style":537},[1387],{"type":50,"value":1388},".aggregate(",{"type":45,"tag":520,"props":1390,"children":1391},{"style":543},[1392],{"type":50,"value":1261},{"type":45,"tag":520,"props":1394,"children":1395},{"style":674},[1396],{"type":50,"value":1397},"pipeline",{"type":45,"tag":520,"props":1399,"children":1400},{"style":543},[1401],{"type":50,"value":1340},{"type":45,"tag":520,"props":1403,"children":1404},{"style":537},[1405],{"type":50,"value":1363},{"type":45,"tag":150,"props":1407,"children":1409},{"id":1408},"step-2-analyze-explain-output",[1410],{"type":50,"value":1411},"Step 2: Analyze Explain Output",{"type":45,"tag":60,"props":1413,"children":1414},{},[1415,1417,1423,1425,1430],{"type":50,"value":1416},"From the ",{"type":45,"tag":171,"props":1418,"children":1420},{"className":1419},[],[1421],{"type":50,"value":1422},"explain(\"executionStats\")",{"type":50,"value":1424}," response (via MCP ",{"type":45,"tag":171,"props":1426,"children":1428},{"className":1427},[],[1429],{"type":50,"value":196},{"type":50,"value":1431}," or\ndirect mongosh), extract:",{"type":45,"tag":74,"props":1433,"children":1434},{},[1435,1474,1484,1494],{"type":45,"tag":78,"props":1436,"children":1437},{},[1438,1443,1445,1451,1453,1459,1460,1466,1468],{"type":45,"tag":66,"props":1439,"children":1440},{},[1441],{"type":50,"value":1442},"metrics",{"type":50,"value":1444},": ",{"type":45,"tag":171,"props":1446,"children":1448},{"className":1447},[],[1449],{"type":50,"value":1450},"totalKeysExamined",{"type":50,"value":1452},", ",{"type":45,"tag":171,"props":1454,"children":1456},{"className":1455},[],[1457],{"type":50,"value":1458},"totalDocsExamined",{"type":50,"value":1452},{"type":45,"tag":171,"props":1461,"children":1463},{"className":1462},[],[1464],{"type":50,"value":1465},"nReturned",{"type":50,"value":1467},",\n",{"type":45,"tag":171,"props":1469,"children":1471},{"className":1470},[],[1472],{"type":50,"value":1473},"executionTimeMillis",{"type":45,"tag":78,"props":1475,"children":1476},{},[1477,1482],{"type":45,"tag":66,"props":1478,"children":1479},{},[1480],{"type":50,"value":1481},"plan_shape",{"type":50,"value":1483},": winning plan stage (IXSCAN vs COLLSCAN), index used",{"type":45,"tag":78,"props":1485,"children":1486},{},[1487,1492],{"type":45,"tag":66,"props":1488,"children":1489},{},[1490],{"type":50,"value":1491},"indexes_stats",{"type":50,"value":1493},": which indexes exist and their usage frequency",{"type":45,"tag":78,"props":1495,"children":1496},{},[1497,1502],{"type":45,"tag":66,"props":1498,"children":1499},{},[1500],{"type":50,"value":1501},"collection_stats",{"type":50,"value":1503},": total document count, average document size",{"type":45,"tag":60,"props":1505,"children":1506},{},[1507],{"type":45,"tag":66,"props":1508,"children":1509},{},[1510],{"type":50,"value":1511},"Key ratios to evaluate:",{"type":45,"tag":338,"props":1513,"children":1514},{},[1515,1536],{"type":45,"tag":342,"props":1516,"children":1517},{},[1518],{"type":45,"tag":346,"props":1519,"children":1520},{},[1521,1526,1531],{"type":45,"tag":350,"props":1522,"children":1523},{"align":352},[1524],{"type":50,"value":1525},"Metric",{"type":45,"tag":350,"props":1527,"children":1528},{"align":352},[1529],{"type":50,"value":1530},"Good",{"type":45,"tag":350,"props":1532,"children":1533},{"align":352},[1534],{"type":50,"value":1535},"Bad",{"type":45,"tag":362,"props":1537,"children":1538},{},[1539,1557,1574,1592],{"type":45,"tag":346,"props":1540,"children":1541},{},[1542,1547,1552],{"type":45,"tag":369,"props":1543,"children":1544},{"align":352},[1545],{"type":50,"value":1546},"keysExamined \u002F nReturned",{"type":45,"tag":369,"props":1548,"children":1549},{"align":352},[1550],{"type":50,"value":1551},"Close to 1",{"type":45,"tag":369,"props":1553,"children":1554},{"align":352},[1555],{"type":50,"value":1556},">> 1 (poor selectivity)",{"type":45,"tag":346,"props":1558,"children":1559},{},[1560,1565,1569],{"type":45,"tag":369,"props":1561,"children":1562},{"align":352},[1563],{"type":50,"value":1564},"docsExamined \u002F nReturned",{"type":45,"tag":369,"props":1566,"children":1567},{"align":352},[1568],{"type":50,"value":1551},{"type":45,"tag":369,"props":1570,"children":1571},{"align":352},[1572],{"type":50,"value":1573},">> 1 (scanning too many docs)",{"type":45,"tag":346,"props":1575,"children":1576},{},[1577,1582,1587],{"type":45,"tag":369,"props":1578,"children":1579},{"align":352},[1580],{"type":50,"value":1581},"Plan stage",{"type":45,"tag":369,"props":1583,"children":1584},{"align":352},[1585],{"type":50,"value":1586},"IXSCAN",{"type":45,"tag":369,"props":1588,"children":1589},{"align":352},[1590],{"type":50,"value":1591},"COLLSCAN (no index)",{"type":45,"tag":346,"props":1593,"children":1594},{},[1595,1600,1605],{"type":45,"tag":369,"props":1596,"children":1597},{"align":352},[1598],{"type":50,"value":1599},"Sort stage",{"type":45,"tag":369,"props":1601,"children":1602},{"align":352},[1603],{"type":50,"value":1604},"In-memory: false",{"type":45,"tag":369,"props":1606,"children":1607},{"align":352},[1608],{"type":50,"value":1609},"In-memory: true (blocking sort)",{"type":45,"tag":150,"props":1611,"children":1613},{"id":1612},"step-3-diagnose",[1614],{"type":50,"value":1615},"Step 3: Diagnose",{"type":45,"tag":60,"props":1617,"children":1618},{},[1619],{"type":50,"value":1620},"Common issues and their root causes:",{"type":45,"tag":74,"props":1622,"children":1623},{},[1624,1634,1644,1654],{"type":45,"tag":78,"props":1625,"children":1626},{},[1627,1632],{"type":45,"tag":66,"props":1628,"children":1629},{},[1630],{"type":50,"value":1631},"COLLSCAN",{"type":50,"value":1633}," → No index supports the query filter. Create an index on\nthe filter fields.",{"type":45,"tag":78,"props":1635,"children":1636},{},[1637,1642],{"type":45,"tag":66,"props":1638,"children":1639},{},[1640],{"type":50,"value":1641},"High keysExamined vs nReturned",{"type":50,"value":1643}," → Index exists but has poor selectivity.\nConsider a more selective compound index.",{"type":45,"tag":78,"props":1645,"children":1646},{},[1647,1652],{"type":45,"tag":66,"props":1648,"children":1649},{},[1650],{"type":50,"value":1651},"In-memory sort",{"type":50,"value":1653}," → Sort field is not indexed. Add sort field to the index\n(after equality fields, before range fields).",{"type":45,"tag":78,"props":1655,"children":1656},{},[1657,1662],{"type":45,"tag":66,"props":1658,"children":1659},{},[1660],{"type":50,"value":1661},"Large docsExamined",{"type":50,"value":1663}," → Index doesn't cover the query. Consider a covering\nindex that includes projected fields.",{"type":45,"tag":150,"props":1665,"children":1667},{"id":1666},"step-4-recommend",[1668],{"type":50,"value":1669},"Step 4: Recommend",{"type":45,"tag":60,"props":1671,"children":1672},{},[1673,1675,1680],{"type":50,"value":1674},"Follow the ",{"type":45,"tag":66,"props":1676,"children":1677},{},[1678],{"type":50,"value":1679},"ESR Rule",{"type":50,"value":1681}," (Equality → Sort → Range) for compound index design:",{"type":45,"tag":162,"props":1683,"children":1684},{},[1685,1703,1720],{"type":45,"tag":78,"props":1686,"children":1687},{},[1688,1693,1695,1701],{"type":45,"tag":66,"props":1689,"children":1690},{},[1691],{"type":50,"value":1692},"Equality",{"type":50,"value":1694}," fields first (fields with ",{"type":45,"tag":171,"props":1696,"children":1698},{"className":1697},[],[1699],{"type":50,"value":1700},"$eq",{"type":50,"value":1702}," \u002F exact match)",{"type":45,"tag":78,"props":1704,"children":1705},{},[1706,1711,1713,1718],{"type":45,"tag":66,"props":1707,"children":1708},{},[1709],{"type":50,"value":1710},"Sort",{"type":50,"value":1712}," fields next (fields in the ",{"type":45,"tag":171,"props":1714,"children":1716},{"className":1715},[],[1717],{"type":50,"value":1354},{"type":50,"value":1719}," specification)",{"type":45,"tag":78,"props":1721,"children":1722},{},[1723,1728,1730,1736,1737,1743,1744,1750,1751,1757,1758,1764],{"type":45,"tag":66,"props":1724,"children":1725},{},[1726],{"type":50,"value":1727},"Range",{"type":50,"value":1729}," fields last (fields with ",{"type":45,"tag":171,"props":1731,"children":1733},{"className":1732},[],[1734],{"type":50,"value":1735},"$gt",{"type":50,"value":1452},{"type":45,"tag":171,"props":1738,"children":1740},{"className":1739},[],[1741],{"type":50,"value":1742},"$lt",{"type":50,"value":1452},{"type":45,"tag":171,"props":1745,"children":1747},{"className":1746},[],[1748],{"type":50,"value":1749},"$gte",{"type":50,"value":1452},{"type":45,"tag":171,"props":1752,"children":1754},{"className":1753},[],[1755],{"type":50,"value":1756},"$lte",{"type":50,"value":1452},{"type":45,"tag":171,"props":1759,"children":1761},{"className":1760},[],[1762],{"type":50,"value":1763},"$in",{"type":50,"value":586},{"type":45,"tag":60,"props":1766,"children":1767},{},[1768,1773,1775,1781,1783,1789],{"type":45,"tag":66,"props":1769,"children":1770},{},[1771],{"type":50,"value":1772},"Example:",{"type":50,"value":1774},"\nQuery: ",{"type":45,"tag":171,"props":1776,"children":1778},{"className":1777},[],[1779],{"type":50,"value":1780},"db.orders.find({status: 'shipped', region: 'US'}).sort({date: -1})",{"type":50,"value":1782},"\nRecommended index: ",{"type":45,"tag":171,"props":1784,"children":1786},{"className":1785},[],[1787],{"type":50,"value":1788},"{status: 1, region: 1, date: -1}",{"type":50,"value":1790},"\n(Two equality fields, then sort field)",{"type":45,"tag":150,"props":1792,"children":1794},{"id":1793},"step-5-verify-optional",[1795],{"type":50,"value":1796},"Step 5: Verify (Optional)",{"type":45,"tag":60,"props":1798,"children":1799},{},[1800],{"type":50,"value":1801},"After creating the recommended index, re-run the explain to confirm improvement:",{"type":45,"tag":162,"props":1803,"children":1804},{},[1805,1810,1828],{"type":45,"tag":78,"props":1806,"children":1807},{},[1808],{"type":50,"value":1809},"Create the index (with user approval)",{"type":45,"tag":78,"props":1811,"children":1812},{},[1813,1815,1820,1821,1826],{"type":50,"value":1814},"Re-run ",{"type":45,"tag":171,"props":1816,"children":1818},{"className":1817},[],[1819],{"type":50,"value":196},{"type":50,"value":178},{"type":45,"tag":171,"props":1822,"children":1824},{"className":1823},[],[1825],{"type":50,"value":203},{"type":50,"value":1827}," (mongosh) with the same query",{"type":45,"tag":78,"props":1829,"children":1830},{},[1831],{"type":50,"value":1832},"Compare metrics before and after",{"type":45,"tag":53,"props":1834,"children":1836},{"id":1835},"example-workflow",[1837],{"type":50,"value":1838},"Example Workflow",{"type":45,"tag":60,"props":1840,"children":1841},{},[1842,1847,1849,1854],{"type":45,"tag":66,"props":1843,"children":1844},{},[1845],{"type":50,"value":1846},"User:",{"type":50,"value":1848}," \"Why is this query slow?\n",{"type":45,"tag":171,"props":1850,"children":1852},{"className":1851},[],[1853],{"type":50,"value":1780},{"type":50,"value":604},{"type":45,"tag":60,"props":1856,"children":1857},{},[1858,1863],{"type":45,"tag":66,"props":1859,"children":1860},{},[1861],{"type":50,"value":1862},"If MCP connection is available",{"type":50,"value":1864},", run steps 1–3:",{"type":45,"tag":162,"props":1866,"children":1867},{},[1868,1930,1970],{"type":45,"tag":78,"props":1869,"children":1870},{},[1871,1876],{"type":45,"tag":66,"props":1872,"children":1873},{},[1874],{"type":50,"value":1875},"Check existing indexes:",{"type":45,"tag":74,"props":1877,"children":1878},{},[1879,1905],{"type":45,"tag":78,"props":1880,"children":1881},{},[1882,1884,1889,1891,1897,1899],{"type":50,"value":1883},"Call ",{"type":45,"tag":171,"props":1885,"children":1887},{"className":1886},[],[1888],{"type":50,"value":176},{"type":50,"value":1890}," with database=",{"type":45,"tag":171,"props":1892,"children":1894},{"className":1893},[],[1895],{"type":50,"value":1896},"store",{"type":50,"value":1898},", collection=",{"type":45,"tag":171,"props":1900,"children":1902},{"className":1901},[],[1903],{"type":50,"value":1904},"orders",{"type":45,"tag":78,"props":1906,"children":1907},{},[1908,1910,1916,1917,1923,1924],{"type":50,"value":1909},"Result shows: ",{"type":45,"tag":171,"props":1911,"children":1913},{"className":1912},[],[1914],{"type":50,"value":1915},"{_id: 1}",{"type":50,"value":1452},{"type":45,"tag":171,"props":1918,"children":1920},{"className":1919},[],[1921],{"type":50,"value":1922},"{status: 1}",{"type":50,"value":1452},{"type":45,"tag":171,"props":1925,"children":1927},{"className":1926},[],[1928],{"type":50,"value":1929},"{date: -1}",{"type":45,"tag":78,"props":1931,"children":1932},{},[1933,1938],{"type":45,"tag":66,"props":1934,"children":1935},{},[1936],{"type":50,"value":1937},"Run explain:",{"type":45,"tag":74,"props":1939,"children":1940},{},[1941,1958],{"type":45,"tag":78,"props":1942,"children":1943},{},[1944,1945,1950,1952],{"type":50,"value":1883},{"type":45,"tag":171,"props":1946,"children":1948},{"className":1947},[],[1949],{"type":50,"value":196},{"type":50,"value":1951}," with operation=",{"type":45,"tag":171,"props":1953,"children":1955},{"className":1954},[],[1956],{"type":50,"value":1957},"{find: \"orders\", filter: {status: \"shipped\", region: \"US\"}, sort: {date: -1}}",{"type":45,"tag":78,"props":1959,"children":1960},{},[1961,1963,1968],{"type":50,"value":1962},"Result: Uses ",{"type":45,"tag":171,"props":1964,"children":1966},{"className":1965},[],[1967],{"type":50,"value":1922},{"type":50,"value":1969}," index, then in-memory SORT,\ntotalKeysExamined: 50000, nReturned: 100",{"type":45,"tag":78,"props":1971,"children":1972},{},[1973,1978],{"type":45,"tag":66,"props":1974,"children":1975},{},[1976],{"type":50,"value":1977},"Fetch sample:",{"type":45,"tag":74,"props":1979,"children":1980},{},[1981],{"type":45,"tag":78,"props":1982,"children":1983},{},[1984,1985,1990],{"type":50,"value":1883},{"type":45,"tag":171,"props":1986,"children":1988},{"className":1987},[],[1989],{"type":50,"value":215},{"type":50,"value":1991}," with limit=1 to understand the schema",{"type":45,"tag":60,"props":1993,"children":1994},{},[1995,2000],{"type":45,"tag":66,"props":1996,"children":1997},{},[1998],{"type":50,"value":1999},"If MCP is not available",{"type":50,"value":2001},", use mongosh directly:",{"type":45,"tag":509,"props":2003,"children":2005},{"className":511,"code":2004,"language":513,"meta":514,"style":514},"use store\ndb.orders.getIndexes()\ndb.orders.find({status: \"shipped\", region: \"US\"}).sort({date: -1}).explain(\"executionStats\")\ndb.orders.findOne()\n",[2006],{"type":45,"tag":171,"props":2007,"children":2008},{"__ignoreMap":514},[2009,2017,2044,2202],{"type":45,"tag":520,"props":2010,"children":2011},{"class":522,"line":523},[2012],{"type":45,"tag":520,"props":2013,"children":2014},{"style":537},[2015],{"type":50,"value":2016},"use store\n",{"type":45,"tag":520,"props":2018,"children":2019},{"class":522,"line":533},[2020,2024,2028,2032,2036,2040],{"type":45,"tag":520,"props":2021,"children":2022},{"style":537},[2023],{"type":50,"value":540},{"type":45,"tag":520,"props":2025,"children":2026},{"style":543},[2027],{"type":50,"value":546},{"type":45,"tag":520,"props":2029,"children":2030},{"style":537},[2031],{"type":50,"value":1904},{"type":45,"tag":520,"props":2033,"children":2034},{"style":543},[2035],{"type":50,"value":546},{"type":45,"tag":520,"props":2037,"children":2038},{"style":558},[2039],{"type":50,"value":951},{"type":45,"tag":520,"props":2041,"children":2042},{"style":537},[2043],{"type":50,"value":909},{"type":45,"tag":520,"props":2045,"children":2046},{"class":522,"line":622},[2047,2051,2055,2059,2063,2067,2071,2075,2080,2084,2088,2093,2097,2101,2106,2110,2114,2119,2123,2127,2131,2135,2139,2143,2147,2152,2156,2161,2166,2170,2174,2178,2182,2186,2190,2194,2198],{"type":45,"tag":520,"props":2048,"children":2049},{"style":537},[2050],{"type":50,"value":540},{"type":45,"tag":520,"props":2052,"children":2053},{"style":543},[2054],{"type":50,"value":546},{"type":45,"tag":520,"props":2056,"children":2057},{"style":537},[2058],{"type":50,"value":1904},{"type":45,"tag":520,"props":2060,"children":2061},{"style":543},[2062],{"type":50,"value":546},{"type":45,"tag":520,"props":2064,"children":2065},{"style":558},[2066],{"type":50,"value":561},{"type":45,"tag":520,"props":2068,"children":2069},{"style":537},[2070],{"type":50,"value":566},{"type":45,"tag":520,"props":2072,"children":2073},{"style":543},[2074],{"type":50,"value":571},{"type":45,"tag":520,"props":2076,"children":2077},{"style":674},[2078],{"type":50,"value":2079},"status",{"type":45,"tag":520,"props":2081,"children":2082},{"style":543},[2083],{"type":50,"value":780},{"type":45,"tag":520,"props":2085,"children":2086},{"style":543},[2087],{"type":50,"value":798},{"type":45,"tag":520,"props":2089,"children":2090},{"style":607},[2091],{"type":50,"value":2092},"shipped",{"type":45,"tag":520,"props":2094,"children":2095},{"style":543},[2096],{"type":50,"value":604},{"type":45,"tag":520,"props":2098,"children":2099},{"style":543},[2100],{"type":50,"value":811},{"type":45,"tag":520,"props":2102,"children":2103},{"style":674},[2104],{"type":50,"value":2105}," region",{"type":45,"tag":520,"props":2107,"children":2108},{"style":543},[2109],{"type":50,"value":780},{"type":45,"tag":520,"props":2111,"children":2112},{"style":543},[2113],{"type":50,"value":798},{"type":45,"tag":520,"props":2115,"children":2116},{"style":607},[2117],{"type":50,"value":2118},"US",{"type":45,"tag":520,"props":2120,"children":2121},{"style":543},[2122],{"type":50,"value":604},{"type":45,"tag":520,"props":2124,"children":2125},{"style":543},[2126],{"type":50,"value":581},{"type":45,"tag":520,"props":2128,"children":2129},{"style":537},[2130],{"type":50,"value":586},{"type":45,"tag":520,"props":2132,"children":2133},{"style":543},[2134],{"type":50,"value":546},{"type":45,"tag":520,"props":2136,"children":2137},{"style":558},[2138],{"type":50,"value":1354},{"type":45,"tag":520,"props":2140,"children":2141},{"style":537},[2142],{"type":50,"value":566},{"type":45,"tag":520,"props":2144,"children":2145},{"style":543},[2146],{"type":50,"value":571},{"type":45,"tag":520,"props":2148,"children":2149},{"style":674},[2150],{"type":50,"value":2151},"date",{"type":45,"tag":520,"props":2153,"children":2154},{"style":543},[2155],{"type":50,"value":780},{"type":45,"tag":520,"props":2157,"children":2158},{"style":543},[2159],{"type":50,"value":2160}," -",{"type":45,"tag":520,"props":2162,"children":2163},{"style":1097},[2164],{"type":50,"value":2165},"1",{"type":45,"tag":520,"props":2167,"children":2168},{"style":543},[2169],{"type":50,"value":581},{"type":45,"tag":520,"props":2171,"children":2172},{"style":537},[2173],{"type":50,"value":586},{"type":45,"tag":520,"props":2175,"children":2176},{"style":543},[2177],{"type":50,"value":546},{"type":45,"tag":520,"props":2179,"children":2180},{"style":558},[2181],{"type":50,"value":595},{"type":45,"tag":520,"props":2183,"children":2184},{"style":537},[2185],{"type":50,"value":566},{"type":45,"tag":520,"props":2187,"children":2188},{"style":543},[2189],{"type":50,"value":604},{"type":45,"tag":520,"props":2191,"children":2192},{"style":607},[2193],{"type":50,"value":610},{"type":45,"tag":520,"props":2195,"children":2196},{"style":543},[2197],{"type":50,"value":604},{"type":45,"tag":520,"props":2199,"children":2200},{"style":537},[2201],{"type":50,"value":619},{"type":45,"tag":520,"props":2203,"children":2204},{"class":522,"line":632},[2205,2209,2213,2217,2221,2226],{"type":45,"tag":520,"props":2206,"children":2207},{"style":537},[2208],{"type":50,"value":540},{"type":45,"tag":520,"props":2210,"children":2211},{"style":543},[2212],{"type":50,"value":546},{"type":45,"tag":520,"props":2214,"children":2215},{"style":537},[2216],{"type":50,"value":1904},{"type":45,"tag":520,"props":2218,"children":2219},{"style":543},[2220],{"type":50,"value":546},{"type":45,"tag":520,"props":2222,"children":2223},{"style":558},[2224],{"type":50,"value":2225},"findOne",{"type":45,"tag":520,"props":2227,"children":2228},{"style":537},[2229],{"type":50,"value":909},{"type":45,"tag":162,"props":2231,"children":2232},{"start":632},[2233,2250],{"type":45,"tag":78,"props":2234,"children":2235},{},[2236,2241,2243,2248],{"type":45,"tag":66,"props":2237,"children":2238},{},[2239],{"type":50,"value":2240},"Diagnose:",{"type":50,"value":2242}," This query targets 100 docs but scans 50K index entries (poor\nselectivity: 0.002). In-memory sort adds overhead. The ",{"type":45,"tag":171,"props":2244,"children":2246},{"className":2245},[],[2247],{"type":50,"value":1922},{"type":50,"value":2249}," index\ndoesn't support both filter fields or sort.",{"type":45,"tag":78,"props":2251,"children":2252},{},[2253,2258,2260,2265],{"type":45,"tag":66,"props":2254,"children":2255},{},[2256],{"type":50,"value":2257},"Recommend:",{"type":50,"value":2259}," Create compound index ",{"type":45,"tag":171,"props":2261,"children":2263},{"className":2262},[],[2264],{"type":50,"value":1788},{"type":50,"value":2266},"\nfollowing ESR (two equality fields, then sort). This eliminates in-memory\nsort and improves selectivity.",{"type":45,"tag":53,"props":2268,"children":2270},{"id":2269},"azure-documentdb-specifics",[2271],{"type":50,"value":2272},"Azure DocumentDB Specifics",{"type":45,"tag":74,"props":2274,"children":2275},{},[2276,2286,2304,2314,2324,2334],{"type":45,"tag":78,"props":2277,"children":2278},{},[2279,2284],{"type":45,"tag":66,"props":2280,"children":2281},{},[2282],{"type":50,"value":2283},"Index types supported",{"type":50,"value":2285},": Single field, compound, text, geospatial\n(2dsphere), wildcard, unique",{"type":45,"tag":78,"props":2287,"children":2288},{},[2289,2294,2296,2302],{"type":45,"tag":66,"props":2290,"children":2291},{},[2292],{"type":50,"value":2293},"Default _id index",{"type":50,"value":2295},": Every collection has an automatic ",{"type":45,"tag":171,"props":2297,"children":2299},{"className":2298},[],[2300],{"type":50,"value":2301},"_id",{"type":50,"value":2303}," index",{"type":45,"tag":78,"props":2305,"children":2306},{},[2307,2312],{"type":45,"tag":66,"props":2308,"children":2309},{},[2310],{"type":50,"value":2311},"Compound index limit",{"type":50,"value":2313},": Check current Azure documentation for maximum\nnumber of fields in a compound index",{"type":45,"tag":78,"props":2315,"children":2316},{},[2317,2322],{"type":45,"tag":66,"props":2318,"children":2319},{},[2320],{"type":50,"value":2321},"Index builds",{"type":50,"value":2323},": Index creation on Azure DocumentDB may take time for large collections;\nthe operation runs in the background",{"type":45,"tag":78,"props":2325,"children":2326},{},[2327,2332],{"type":45,"tag":66,"props":2328,"children":2329},{},[2330],{"type":50,"value":2331},"Covered queries",{"type":50,"value":2333},": Azure DocumentDB supports covered queries (index-only scans) when\nall queried and projected fields are in the index",{"type":45,"tag":78,"props":2335,"children":2336},{},[2337,2342],{"type":45,"tag":66,"props":2338,"children":2339},{},[2340],{"type":50,"value":2341},"Vector search",{"type":50,"value":2343},": Azure DocumentDB supports vector indexes (IVF, HNSW) for similarity\nsearch. If IVF recall is poor, recommend switching to HNSW.",{"type":45,"tag":53,"props":2345,"children":2347},{"id":2346},"output-format",[2348],{"type":50,"value":2349},"Output Format",{"type":45,"tag":74,"props":2351,"children":2352},{},[2353,2358,2363,2368,2373,2378],{"type":45,"tag":78,"props":2354,"children":2355},{},[2356],{"type":50,"value":2357},"Keep answers short and clear: a few sentences on index and optimization\nsuggestions, and reasoning behind them",{"type":45,"tag":78,"props":2359,"children":2360},{},[2361],{"type":50,"value":2362},"Focus on highest-impact optimizations first",{"type":45,"tag":78,"props":2364,"children":2365},{},[2366],{"type":50,"value":2367},"Do not use strong language like \"You should definitely create these indexes\"\n— explain they are suggestions with reasoning",{"type":45,"tag":78,"props":2369,"children":2370},{},[2371],{"type":50,"value":2372},"Consider how many indexes already exist — there shouldn't generally be\nmore than 20",{"type":45,"tag":78,"props":2374,"children":2375},{},[2376],{"type":50,"value":2377},"Do not create or drop indexes directly via MCP unless the user gives approval",{"type":45,"tag":78,"props":2379,"children":2380},{},[2381],{"type":50,"value":2382},"Present before\u002Fafter metrics when possible",{"type":45,"tag":53,"props":2384,"children":2386},{"id":2385},"safety-rules",[2387],{"type":50,"value":2388},"Safety Rules",{"type":45,"tag":74,"props":2390,"children":2391},{},[2392,2400,2405,2410],{"type":45,"tag":78,"props":2393,"children":2394},{},[2395],{"type":45,"tag":66,"props":2396,"children":2397},{},[2398],{"type":50,"value":2399},"NEVER create or drop indexes without explicit user approval",{"type":45,"tag":78,"props":2401,"children":2402},{},[2403],{"type":50,"value":2404},"Always explain what the index change will do and why before asking for\napproval",{"type":45,"tag":78,"props":2406,"children":2407},{},[2408],{"type":50,"value":2409},"If the collection has many existing indexes (>15), warn about the overhead of\nadding more",{"type":45,"tag":78,"props":2411,"children":2412},{},[2413],{"type":50,"value":2414},"For drop recommendations, explain the impact on other queries that may use\nthe index",{"type":45,"tag":2416,"props":2417,"children":2418},"style",{},[2419],{"type":50,"value":2420},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2422,"total":2597},[2423,2442,2461,2480,2495,2510,2523,2538,2549,2561,2572,2585],{"slug":2424,"name":2424,"fn":2425,"description":2426,"org":2427,"tags":2428,"stars":2439,"repoUrl":2440,"updatedAt":2441},"azure-arg-external-evaluation-policy-author","author and test Azure Resource Graph policies","Use when the user wants to author, design, or test an Azure Policy that queries Azure Resource Graph (ARG) at request-time — i.e. a policy whose deny\u002Faudit decision depends on data from elsewhere in the subscription (sibling\u002Fparent resource state, RG-wide invariants, multi-hop relationships, etc.). Formally called Azure Policy External Evaluation; sometimes referred to colloquially as \"Invoke\". Drives an iterative KQL co-design loop against the user's real subscription via `az graph query`, then emits a policy definition, assignment, `.http` test flow, and an `EXPLANATION.md` companion. Read-only; never provisions anything.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2429,2430,2433,2436],{"name":11,"slug":8,"type":16},{"name":2431,"slug":2432,"type":16},"Compliance","compliance",{"name":2434,"slug":2435,"type":16},"Governance","governance",{"name":2437,"slug":2438,"type":16},"Policy","policy",1686,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-policy","2026-07-12T08:17:48.378432",{"slug":2443,"name":2443,"fn":2444,"description":2445,"org":2446,"tags":2447,"stars":2458,"repoUrl":2459,"updatedAt":2460},"azure-blueprints-migration","migrate Azure Blueprints to Template Specs","Use when a user needs to migrate off Azure Blueprints (definitions and\u002For assignments) to Template Specs and Deployment Stacks before the January 31, 2027 retirement. Covers inventory, export, conversion to Bicep, policy decoupling, Template Spec publishing, Deployment Stack deployment with deny-settings, validation, and cutover.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2448,2449,2452,2455],{"name":11,"slug":8,"type":16},{"name":2450,"slug":2451,"type":16},"Deployment","deployment",{"name":2453,"slug":2454,"type":16},"Infrastructure as Code","infrastructure-as-code",{"name":2456,"slug":2457,"type":16},"Migration","migration",260,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-blueprints","2026-07-12T08:17:49.646405",{"slug":2462,"name":2462,"fn":2463,"description":2464,"org":2465,"tags":2466,"stars":2477,"repoUrl":2478,"updatedAt":2479},"apiview-feedback-resolution","resolve APIView feedback on Azure SDKs","Analyze and resolve APIView review feedback on Azure SDK PRs. **UTILITY SKILL**. USE FOR: APIView comments, API review feedback, SDK API surface changes. DO NOT USE FOR: general code review, non-APIView feedback. INVOKES: azure-sdk-mcp:azsdk_apiview_get_comments, azure-sdk-mcp:azsdk_typespec_customized_code_update.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2467,2470,2471,2474],{"name":2468,"slug":2469,"type":16},"API Development","api-development",{"name":11,"slug":8,"type":16},{"name":2472,"slug":2473,"type":16},"Code Review","code-review",{"name":2475,"slug":2476,"type":16},"Documentation","documentation",133,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-tools","2026-07-12T08:17:43.350876",{"slug":2481,"name":2481,"fn":2482,"description":2483,"org":2484,"tags":2485,"stars":2477,"repoUrl":2478,"updatedAt":2494},"azsdk-common-live-and-recorded-tests","deploy resources and run Azure SDK tests","Deploy test resources and run Azure SDK tests in live, record, or playback mode. WHEN: \"run live tests\", \"run recorded tests\", \"deploy test resources\", \"record tests\", \"run tests in record mode\", \"clean up test resources\", \"run tests against live resources\". DO NOT USE FOR: writing new tests, authoring Bicep templates, playback-only test runs without resource deployment. INVOKES: azure-sdk-mcp:azsdk_package_run_tests.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2486,2487,2488,2491],{"name":11,"slug":8,"type":16},{"name":2450,"slug":2451,"type":16},{"name":2489,"slug":2490,"type":16},"SDK","sdk",{"name":2492,"slug":2493,"type":16},"Testing","testing","2026-07-12T08:17:44.718943",{"slug":2496,"name":2496,"fn":2497,"description":2498,"org":2499,"tags":2500,"stars":2477,"repoUrl":2478,"updatedAt":2509},"azsdk-common-prepare-release-plan","manage Azure SDK release plan work items","Create, get, update, abandon, and link SDK PRs to release plan work items for Azure SDK releases. **UTILITY SKILL**. USE FOR: \"create release plan\", \"get release plan\", \"update release plan\", \"update API spec in release plan\", \"update SDK details in release plan\", \"abandon release plan\", \"link SDK PR to plan\", \"namespace approval\", \"check release plan status\". DO NOT USE FOR: SDK code generation, pipeline troubleshooting, API review feedback. INVOKES: azure-sdk-mcp:azsdk_create_release_plan, azure-sdk-mcp:azsdk_get_release_plan, azure-sdk-mcp:azsdk_get_release_plan_for_spec_pr, azure-sdk-mcp:azsdk_update_release_plan, azure-sdk-mcp:azsdk_update_api_spec_pull_request_in_release_plan, azure-sdk-mcp:azsdk_update_sdk_details_in_release_plan, azure-sdk-mcp:azsdk_abandon_release_plan, azure-sdk-mcp:azsdk_link_sdk_pull_request_to_release_plan, azure-sdk-mcp:azsdk_link_namespace_approval_issue.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2501,2502,2505,2508],{"name":11,"slug":8,"type":16},{"name":2503,"slug":2504,"type":16},"GitHub","github",{"name":2506,"slug":2507,"type":16},"Project Management","project-management",{"name":2489,"slug":2490,"type":16},"2026-07-12T08:17:38.345387",{"slug":2511,"name":2511,"fn":2512,"description":2513,"org":2514,"tags":2515,"stars":2477,"repoUrl":2478,"updatedAt":2522},"azsdk-common-sdk-release","release Azure SDK packages","Check release readiness and trigger the release pipeline for Azure SDK packages. **UTILITY SKILL**. USE FOR: \"release SDK\", \"trigger release\", \"check release readiness\", \"release pipeline\", \"publish package\", \"ship SDK\". DO NOT USE FOR: SDK development, code generation, pipeline debugging, release plan creation. INVOKES: azure-sdk-mcp:azsdk_release_sdk.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2516,2517,2520,2521],{"name":11,"slug":8,"type":16},{"name":2518,"slug":2519,"type":16},"CI\u002FCD","ci-cd",{"name":2450,"slug":2451,"type":16},{"name":2489,"slug":2490,"type":16},"2026-07-12T08:17:34.27607",{"slug":2524,"name":2524,"fn":2525,"description":2526,"org":2527,"tags":2528,"stars":2477,"repoUrl":2478,"updatedAt":2537},"azure-typespec-author","author and modify Azure TypeSpec API specifications","Authors and modifies Azure TypeSpec (.tsp) API specifications. USE FOR: any TypeSpec\u002Ftsp change — api versions (add, bump, preview, stable, promote), resources, operations, models, properties, decorators, visibility, constraints, breaking changes, LRO, suppressions, operationId, spread model. Covers ARM resource-manager and data-plane services. DO NOT USE FOR: SDK generation, releasing SDK packages, or single MCP tool calls. INVOKES: azure-sdk-mcp:azsdk_typespec_generate_authoring_plan, azure-sdk-mcp:azsdk_run_typespec_validation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2529,2530,2531,2534],{"name":2468,"slug":2469,"type":16},{"name":11,"slug":8,"type":16},{"name":2532,"slug":2533,"type":16},"OpenAPI","openapi",{"name":2535,"slug":2536,"type":16},"Technical Writing","technical-writing","2026-07-12T08:17:39.603232",{"slug":2539,"name":2539,"fn":2540,"description":2541,"org":2542,"tags":2543,"stars":2477,"repoUrl":2478,"updatedAt":2548},"generate-sdk-locally","generate and test Azure SDKs locally","Generate, build, and test Azure SDKs locally from TypeSpec with automatic customization. WHEN: \"generate SDK locally\", \"build SDK\", \"run SDK tests\", \"run CI checks\", \"validate package\", \"run checks\", \"update changelog\", \"fix SDK build errors\", \"fix breaking changes\", \"resolve SDK generation errors\", \"customize TypeSpec\", \"rename SDK client\", \"rename SDK model\", \"hide operation from SDK\", \"fix analyzer errors\", \"resolve customization drift\", \"create subclient\", \"update metadata\", \"update version\". DO NOT USE FOR: publishing to package registries, CI pipeline configuration, API design review. INVOKES: azsdk_verify_setup, azsdk_package_generate_code, azsdk_package_build_code, azsdk_package_run_check, azsdk_package_run_tests, azsdk_customized_code_update, azsdk_package_update_changelog_content, azsdk_package_update_metadata, azsdk_package_update_version.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2544,2545,2546,2547],{"name":11,"slug":8,"type":16},{"name":2518,"slug":2519,"type":16},{"name":2489,"slug":2490,"type":16},{"name":2492,"slug":2493,"type":16},"2026-07-12T08:17:37.08523",{"slug":2550,"name":2550,"fn":2551,"description":2552,"org":2553,"tags":2554,"stars":2477,"repoUrl":2478,"updatedAt":2560},"markdown-token-optimizer","optimize markdown files for token efficiency","Analyze markdown files for token efficiency and reduce context-window bloat. **UTILITY SKILL**. DO NOT USE FOR: code optimization, general file editing, non-markdown files. TRIGGERS: optimize markdown, reduce tokens, token count, token bloat, too many tokens, make concise, shrink file, file too large, optimize for AI, token efficiency, verbose markdown, reduce file size. INVOKES: waza CLI.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2555,2558,2559],{"name":2556,"slug":2557,"type":16},"LLM","llm",{"name":14,"slug":15,"type":16},{"name":2535,"slug":2536,"type":16},"2026-07-12T08:17:42.080413",{"slug":2562,"name":2562,"fn":2563,"description":2564,"org":2565,"tags":2566,"stars":2477,"repoUrl":2478,"updatedAt":2571},"pipeline-troubleshooting","troubleshoot Azure SDK CI pipelines","Diagnose and resolve failures in Azure SDK CI and generation pipelines. **UTILITY SKILL**. USE FOR: \"pipeline failed\", \"build failure\", \"CI check failing\", \"SDK generation error\", \"reproduce pipeline locally\", \"debug SDK pipeline\". DO NOT USE FOR: local build issues without pipeline context, API design review, SDK publishing. INVOKES: azure-sdk-mcp:azsdk_analyze_pipeline, azure-sdk-mcp:azsdk_package_build_code, azure-sdk-mcp:azsdk_package_run_check.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2567,2568,2569,2570],{"name":11,"slug":8,"type":16},{"name":2518,"slug":2519,"type":16},{"name":25,"slug":26,"type":16},{"name":2489,"slug":2490,"type":16},"2026-07-12T08:17:40.821512",{"slug":2573,"name":2573,"fn":2574,"description":2575,"org":2576,"tags":2577,"stars":2477,"repoUrl":2478,"updatedAt":2584},"sensei","improve skill frontmatter compliance","**WORKFLOW SKILL** — Iteratively improve skill frontmatter compliance using the Ralph loop pattern. WHEN: \"run sensei\", \"sensei help\", \"improve skill\", \"fix frontmatter\", \"skill compliance\", \"frontmatter audit\", \"score skill\", \"check skill tokens\". INVOKES: token counting tools, test runners, git commands. FOR SINGLE OPERATIONS: use token CLI directly for counts\u002Fchecks.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2578,2579,2580,2583],{"name":11,"slug":8,"type":16},{"name":2431,"slug":2432,"type":16},{"name":2581,"slug":2582,"type":16},"Process Optimization","process-optimization",{"name":2535,"slug":2536,"type":16},"2026-07-12T08:17:32.970921",{"slug":2586,"name":2586,"fn":2587,"description":2588,"org":2589,"tags":2590,"stars":2477,"repoUrl":2478,"updatedAt":2596},"skill-authoring","author agent skills for agentskills.io","Write Agent Skills that comply with the agentskills.io specification. WHEN: \"create a skill\", \"new skill\", \"write a skill\", \"skill template\", \"skill structure\", \"review skill\", \"skill PR\", \"skill compliance\", \"SKILL.md format\", \"skill frontmatter\", \"skill best practices\". DO NOT USE FOR: improving existing skills (use sensei), general documentation. INVOKES: waza CLI.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2591,2592,2595],{"name":2475,"slug":2476,"type":16},{"name":2593,"slug":2594,"type":16},"Plugin Development","plugin-development",{"name":2535,"slug":2536,"type":16},"2026-07-12T08:17:35.873862",109,{"items":2599,"total":975},[2600,2619,2629,2644,2655,2667,2680],{"slug":2601,"name":2601,"fn":2602,"description":2603,"org":2604,"tags":2605,"stars":27,"repoUrl":28,"updatedAt":2618},"documentdb-azure-deployment","deploy Azure DocumentDB clusters","Deploy an Azure DocumentDB cluster (`Microsoft.DocumentDB\u002FmongoClusters`) end-to-end — Bicep (primary), Azure CLI one-shot, Terraform, or portal. Covers resource-group creation, cluster parameters (tier, storage, server version, sharding, HA), firewall rule configuration, retrieving the connection string, and teardown. Use when the user asks to provision, create, deploy, or spin up an Azure DocumentDB cluster, or wants infrastructure-as-code for one.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2606,2607,2610,2613,2614,2615],{"name":11,"slug":8,"type":16},{"name":2608,"slug":2609,"type":16},"Bicep","bicep",{"name":2611,"slug":2612,"type":16},"CLI","cli",{"name":22,"slug":23,"type":16},{"name":2450,"slug":2451,"type":16},{"name":2616,"slug":2617,"type":16},"Terraform","terraform","2026-07-12T08:18:56.861159",{"slug":2620,"name":2620,"fn":2621,"description":2622,"org":2623,"tags":2624,"stars":27,"repoUrl":28,"updatedAt":2628},"documentdb-connection","configure MongoDB connections for DocumentDB","Optimize MongoDB client connection configuration (pools, timeouts, patterns) for Azure DocumentDB. Use this skill when working on functions that instantiate or configure a MongoDB client (e.g., calling `connect()`), configuring connection pools, troubleshooting connection errors (ECONNREFUSED, timeouts, pool exhaustion), optimizing connection-related performance issues. Includes scenarios like building serverless functions, creating API endpoints, optimizing high-traffic applications, or debugging connection failures.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2625,2626,2627],{"name":11,"slug":8,"type":16},{"name":22,"slug":23,"type":16},{"name":14,"slug":15,"type":16},"2026-07-12T08:18:49.875358",{"slug":2630,"name":2630,"fn":2631,"description":2632,"org":2633,"tags":2634,"stars":27,"repoUrl":28,"updatedAt":2643},"documentdb-data-modeling","design Azure DocumentDB data models","Data modeling patterns for Azure DocumentDB — embed vs reference, 16 MB document limit, denormalization for read-heavy workloads, schema versioning. Use when designing new schemas, reviewing existing data models, migrating from SQL, deciding between embedding and referencing, modeling one-to-one \u002F one-to-many \u002F many-to-many relationships, or troubleshooting document-size and query-performance problems that stem from the data model.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2635,2636,2639,2640],{"name":11,"slug":8,"type":16},{"name":2637,"slug":2638,"type":16},"Data Modeling","data-modeling",{"name":22,"slug":23,"type":16},{"name":2641,"slug":2642,"type":16},"MongoDB","mongodb","2026-08-01T05:42:33.42955",{"slug":2645,"name":2645,"fn":2646,"description":2647,"org":2648,"tags":2649,"stars":27,"repoUrl":28,"updatedAt":2654},"documentdb-driver","implement Azure DocumentDB driver best practices","MongoDB driver and SDK best practices for Azure DocumentDB — singleton `MongoClient`, connection reuse, connection-pool fundamentals. Use when writing code that instantiates a MongoDB client, reviewing driver initialization, or diagnosing connection-related bugs. For full connection-pool tuning (serverless vs OLTP vs OLAP, timeouts, retries), see the `documentdb-connection` skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2650,2651,2652,2653],{"name":11,"slug":8,"type":16},{"name":22,"slug":23,"type":16},{"name":2641,"slug":2642,"type":16},{"name":2489,"slug":2490,"type":16},"2026-07-12T08:18:42.136316",{"slug":2656,"name":2656,"fn":2657,"description":2658,"org":2659,"tags":2660,"stars":27,"repoUrl":28,"updatedAt":2666},"documentdb-full-text-search","implement full-text search in Azure DocumentDB","Full-text search best practices for Azure DocumentDB using the `createSearchIndexes` command and `$search` aggregation stage — BM25 keyword scoring, fuzzy search (`maxEdits`), phrase search with `slop`, custom analyzers (keyword + lowerCase + asciiFolding + edgeGram) for prefix \u002F ID matching, `pathHierarchy` tokenizer for hierarchical IDs, multi-field search indexes, and hybrid (BM25 + vector) retrieval via Reciprocal Rank Fusion. Use when building search experiences, adding typo tolerance, matching phrases or prefixes on IDs \u002F SKUs \u002F part numbers, or combining lexical and semantic retrieval on the same collection.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2661,2662,2663],{"name":11,"slug":8,"type":16},{"name":22,"slug":23,"type":16},{"name":2664,"slug":2665,"type":16},"Search","search","2026-07-15T06:02:41.270913",{"slug":2668,"name":2668,"fn":2669,"description":2670,"org":2671,"tags":2672,"stars":27,"repoUrl":28,"updatedAt":2679},"documentdb-high-availability","configure high availability for DocumentDB","High availability, business-continuity, and disaster-recovery best practices for Azure DocumentDB — enabling in-region HA with availability zones (99.99% SLA), adding active-passive cross-region replica clusters (99.995% SLA), and understanding automatic backup retention. Use when designing production topology, planning failover, provisioning DR, picking regions, or reviewing cluster architecture.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2673,2674,2675,2678],{"name":11,"slug":8,"type":16},{"name":22,"slug":23,"type":16},{"name":2676,"slug":2677,"type":16},"Operations","operations",{"name":14,"slug":15,"type":16},"2026-07-12T08:18:53.654505",{"slug":2681,"name":2681,"fn":2682,"description":2683,"org":2684,"tags":2685,"stars":27,"repoUrl":28,"updatedAt":2692},"documentdb-indexing","select and shape Azure DocumentDB indexes","Index-type selection and shape guidance for Azure DocumentDB — when to use single-field, compound (ESR), multikey, wildcard, hashed, 2dsphere, TTL, and vector indexes; query-pattern → index-shape cookbook; per-collection index budget; DocumentDB-specific preference for `textSearch` over community `$text`. Use when designing or reviewing indexes, choosing an index type for a query pattern, or deciding whether an additional index is worth the write cost.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2686,2687,2688,2689],{"name":11,"slug":8,"type":16},{"name":19,"slug":20,"type":16},{"name":22,"slug":23,"type":16},{"name":2690,"slug":2691,"type":16},"NoSQL","nosql","2026-07-12T08:18:44.753904"]