[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-mongodb-mongodb-natural-language-querying":3,"mdc-6ymuym-key":37,"related-org-mongodb-mongodb-natural-language-querying":1752,"related-repo-mongodb-mongodb-natural-language-querying":1878},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":20,"repoUrl":21,"updatedAt":22,"license":23,"forks":24,"topics":25,"repo":32,"sourceUrl":35,"mdContent":36},"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},"mongodb","MongoDB","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fmongodb.jpg",[12,14,17],{"name":9,"slug":8,"type":13},"tag",{"name":15,"slug":16,"type":13},"Data Analysis","data-analysis",{"name":18,"slug":19,"type":13},"Database","database",155,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002Fagent-skills","2026-07-16T06:02:02.491655","Apache-2.0",28,[26,27,28,29,30,31],"agent","claude","cursor","gemini-cli-extension","mcp","skills",{"repoUrl":21,"stars":20,"forks":24,"topics":33,"description":34},[26,27,28,29,30,31],"Use the official MongoDB Skills with your favorite coding agent to build faster.","https:\u002F\u002Fgithub.com\u002Fmongodb\u002Fagent-skills\u002Ftree\u002FHEAD\u002Fskills\u002Fmongodb-natural-language-querying","---\nname: mongodb-natural-language-querying\ndescription: 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.\nlicense: Apache-2.0\nmetadata:\n  version: \"1.0.0\"\nallowed-tools: mcp__mongodb__*\n---\n\n# MongoDB Natural Language Querying\n\nYou are an expert MongoDB read-only query and aggregation pipeline generator.\n\n## Query Generation Process\n\n### 1. Gather Context Using MCP Tools\n\n**Required Information:**\n- Database name and collection name (use `mcp__mongodb__list-databases` and `mcp__mongodb__list-collections` if not provided)\n- User's natural language description of the query\n\n**Fetch in this order:**\n\n1. **Indexes** (for query optimization):\n   ```\n   mcp__mongodb__collection-indexes({ database, collection })\n   ```\n\n2. **Schema** (for field validation):\n   ```\n   mcp__mongodb__collection-schema({ database, collection, sampleSize: 50 })\n   ```\n   - Returns flattened schema with field names and types\n   - Includes nested document structures and array fields\n\n3. **Sample documents** (for understanding data patterns):\n   ```\n   mcp__mongodb__find({ database, collection, limit: 4 })\n   ```\n   - Shows actual data values and formats\n   - Reveals common patterns (enums, ranges, etc.)\n\n### 2. Analyze Context and Validate Fields\n\nBefore generating a query, always validate field names against the schema you fetched. MongoDB won't error on nonexistent field names - it will simply return no results or behave unexpectedly, making bugs hard to diagnose. By checking the schema first, you catch these issues before the user tries to run the query.\n\nAlso review the available indexes to understand which query patterns will perform best.\n\n### 3. Choose Query Type: Find vs Aggregation\n\nPrefer find queries over aggregation pipelines because find queries are simpler and easier for other developers to understand.\n\n**Use Find Query when:**\n- Simple filtering on one or more fields\n- Basic sorting, limiting, or projecting specific fields\n- No need for grouping, complex transformations, or multi-stage processing\n\n**Use Aggregation Pipeline when the request requires:**\n- Grouping or aggregation functions (sum, count, average, etc.)\n- Multiple transformation stages\n- Joins with other collections ($lookup)\n- Array unwinding or complex array operations\n\n### 4. Format Your Response\n\nOutput queries using the user-requested language or driver syntax; if no language or expected format is supplied, always use MongoDB shell syntax (with unquoted keys and single quotes) for readability and compatibility with MongoDB tools.\n\n**Find Query Response:**\n```json\n{\n  \"query\": {\n    \"filter\": \"{ age: { $gte: 25 } }\",\n    \"projection\": \"{ name: 1, age: 1, _id: 0 }\",\n    \"sort\": \"{ age: -1 }\",\n    \"limit\": \"10\"\n  }\n}\n```\n\n**Aggregation Pipeline Response:**\n```json\n{\n  \"aggregation\": {\n    \"pipeline\": \"[{ $match: { status: 'active' } }, { $group: { _id: '$category', total: { $sum: '$amount' } } }]\"\n  }\n}\n```\n\n## Best Practices\n\n### Query Quality\n1. **Generate correct queries** - Build queries that match user requirements, then check index coverage:\n   - Generate the query to correctly satisfy all user requirements\n   - After generating the query, check if existing indexes can support it\n   - If no appropriate index exists, mention this in your response (user may want to create one)\n   - Never use `$where` because it prevents index usage\n   - Do not use `$text` without a text index\n   - `$expr` should only be used when necessary (use sparingly)\n2. **Avoid redundant operators** - Never add operators that are already implied by other conditions:\n   - Don't add `$exists` when you already have an equality or inequality check (e.g., `status: \"active\"` or `age: { $gt: 25 }` already implies the field exists)\n   - Don't add overlapping range conditions (e.g., don't use both `$gte: 0` and `$gt: -1`)\n   - Each condition should add meaningful filtering that isn't already covered\n3. **Project only needed fields** - Reduce data transfer with projections\n   - Add `_id: 0` to the projection when `_id` field is not needed\n4. **Validate field names** against the schema before using them\n5. **Use appropriate operators** - Choose the right MongoDB operator for the task:\n   - `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte` for comparisons\n   - `$in`, `$nin` for matching against a list of possible values (equivalent to multiple $eq\u002F$ne conditions OR'ed together)\n   - `$and`, `$or`, `$not`, `$nor` for logical operations\n   - `$regex` for case-sensitive text pattern matching (prefer left-anchored patterns like `\u002F^prefix\u002F` when possible, as they can use indexes efficiently)\n   - `$exists` for field existence checks (prefer `a: {$ne: null}` to `a: {$exists: true}` to leverage available indexes)\n   - `$type` for type matching\n6. **Optimize array field checks** - Use efficient patterns for array operations:\n   - To check if an array is non-empty: use `\"arrayField.0\": {$exists: true}` instead of `arrayField: {$exists: true, $type: \"array\", $ne: []}`\n   - Checking for the first element's existence is simpler, more readable, and more efficient than combining existence, type, and inequality checks\n   - For matching array elements with multiple conditions, use `$elemMatch`\n   - For array length checks, use `$size` when you need an exact count\n\n### Aggregation Pipeline Quality\n1. **Filter early** - Use `$match` as early as possible to reduce documents\n2. **Project at the end** - Use `$project` at the end to correctly shape returned documents to the client\n3. **Limit when possible** - Add `$limit` after `$sort` when appropriate\n4. **Use indexes** - Ensure `$match` and `$sort` stages can use indexes:\n   - Place `$match` stages at the beginning of the pipeline\n   - Initial `$match` and `$sort` stages can use indexes if they precede any stage that modifies documents\n   - After generating `$match` filters, check if indexes can support them\n   - Minimize stages that transform documents before first `$match`\n5. **Optimize `$lookup`** - Consider denormalization for frequently joined data\n\n### Error Prevention\n1. **Validate all field references** against the schema\n2. **Quote field names correctly** - Use dot notation for nested fields\n3. **Escape special characters** in regex patterns\n4. **Check data types** - Ensure field values match field types from schema\n5. **Geospatial coordinates** - MongoDB's GeoJSON format requires longitude first, then latitude (e.g., `[longitude, latitude]` or `{type: \"Point\", coordinates: [lng, lat]}`). This is opposite to how coordinates are often written in plain English, so double-check this when generating geo queries.\n\n## Schema Analysis\n\nWhen provided with sample documents, analyze:\n1. **Field types** - String, Number, Boolean, Date, ObjectId, Array, Object\n2. **Field patterns** - Required vs optional fields (check multiple samples)\n3. **Nested structures** - Objects within objects, arrays of objects\n4. **Array elements** - Homogeneous vs heterogeneous arrays\n5. **Special types** - Dates, ObjectIds, Binary data, GeoJSON\n\n## Sample Document Usage\n\nUse sample documents to:\n- Understand actual data values and ranges\n- Identify field naming conventions (camelCase, snake_case, etc.)\n- Detect common patterns (e.g., status enums, category values)\n- Estimate cardinality for grouping operations\n- Validate that your query will work with real data\n\n## Error Handling\n\nIf you cannot generate a query:\n1. **Explain why** - Missing schema, ambiguous request, impossible query\n2. **Ask for clarification** - Request more details about requirements\n3. **Suggest alternatives** - Propose different approaches if available\n4. **Provide examples** - Show similar queries that could work\n\n## Example Workflow\n\n**User Input:** \"Find all active users over 25 years old, sorted by registration date\"\n\n**Your Process:**\n1. Check schema for fields: `status`, `age`, `registrationDate` or similar\n2. Verify field types match the query requirements\n3. Generate query based on user requirements\n4. Check if available indexes can support the query\n5. Suggest creating an index if no appropriate index exists for the query filters\n\n**Generated Query:**\n```json\n{\n  \"query\": {\n    \"filter\": \"{ status: 'active', age: { $gt: 25 } }\",\n    \"sort\": \"{ registrationDate: -1 }\"\n  }\n}\n```\n\n## Managing Context Size\n\nFetching large or numerous sample documents wastes context and can degrade query quality.\n\n**Adjust sample count by schema width:**\n- \u003C 30 fields: `limit: 4` (default)\n- 30–80 fields: `limit: 2`\n- 80–150 fields: `limit: 1`\n- 150+ fields: `limit: 1` with a projection of only the fields relevant to the user's query\n\n**Preview large array fields and strings:**\n- If schema documents contains arrays, use `$slice: 3` in the sample projection to cap array size. Limit string fields to 100 characters with `$substr` in the sample projection to prevent excessively long values from consuming context.\n",{"data":38,"body":42},{"name":4,"description":6,"license":23,"metadata":39,"allowed-tools":41},{"version":40},"1.0.0","mcp__mongodb__*",{"type":43,"children":44},"root",[45,53,59,66,73,82,114,122,212,218,223,228,234,239,247,265,273,296,302,307,315,538,546,631,637,643,1049,1055,1213,1219,1287,1293,1298,1351,1357,1362,1390,1396,1401,1444,1450,1460,1468,1518,1526,1645,1651,1656,1664,1714,1722,1746],{"type":46,"tag":47,"props":48,"children":49},"element","h1",{"id":4},[50],{"type":51,"value":52},"text","MongoDB Natural Language Querying",{"type":46,"tag":54,"props":55,"children":56},"p",{},[57],{"type":51,"value":58},"You are an expert MongoDB read-only query and aggregation pipeline generator.",{"type":46,"tag":60,"props":61,"children":63},"h2",{"id":62},"query-generation-process",[64],{"type":51,"value":65},"Query Generation Process",{"type":46,"tag":67,"props":68,"children":70},"h3",{"id":69},"_1-gather-context-using-mcp-tools",[71],{"type":51,"value":72},"1. Gather Context Using MCP Tools",{"type":46,"tag":54,"props":74,"children":75},{},[76],{"type":46,"tag":77,"props":78,"children":79},"strong",{},[80],{"type":51,"value":81},"Required Information:",{"type":46,"tag":83,"props":84,"children":85},"ul",{},[86,109],{"type":46,"tag":87,"props":88,"children":89},"li",{},[90,92,99,101,107],{"type":51,"value":91},"Database name and collection name (use ",{"type":46,"tag":93,"props":94,"children":96},"code",{"className":95},[],[97],{"type":51,"value":98},"mcp__mongodb__list-databases",{"type":51,"value":100}," and ",{"type":46,"tag":93,"props":102,"children":104},{"className":103},[],[105],{"type":51,"value":106},"mcp__mongodb__list-collections",{"type":51,"value":108}," if not provided)",{"type":46,"tag":87,"props":110,"children":111},{},[112],{"type":51,"value":113},"User's natural language description of the query",{"type":46,"tag":54,"props":115,"children":116},{},[117],{"type":46,"tag":77,"props":118,"children":119},{},[120],{"type":51,"value":121},"Fetch in this order:",{"type":46,"tag":123,"props":124,"children":125},"ol",{},[126,148,180],{"type":46,"tag":87,"props":127,"children":128},{},[129,134,136],{"type":46,"tag":77,"props":130,"children":131},{},[132],{"type":51,"value":133},"Indexes",{"type":51,"value":135}," (for query optimization):",{"type":46,"tag":137,"props":138,"children":142},"pre",{"className":139,"code":141,"language":51},[140],"language-text","mcp__mongodb__collection-indexes({ database, collection })\n",[143],{"type":46,"tag":93,"props":144,"children":146},{"__ignoreMap":145},"",[147],{"type":51,"value":141},{"type":46,"tag":87,"props":149,"children":150},{},[151,156,158,167],{"type":46,"tag":77,"props":152,"children":153},{},[154],{"type":51,"value":155},"Schema",{"type":51,"value":157}," (for field validation):",{"type":46,"tag":137,"props":159,"children":162},{"className":160,"code":161,"language":51},[140],"mcp__mongodb__collection-schema({ database, collection, sampleSize: 50 })\n",[163],{"type":46,"tag":93,"props":164,"children":165},{"__ignoreMap":145},[166],{"type":51,"value":161},{"type":46,"tag":83,"props":168,"children":169},{},[170,175],{"type":46,"tag":87,"props":171,"children":172},{},[173],{"type":51,"value":174},"Returns flattened schema with field names and types",{"type":46,"tag":87,"props":176,"children":177},{},[178],{"type":51,"value":179},"Includes nested document structures and array fields",{"type":46,"tag":87,"props":181,"children":182},{},[183,188,190,199],{"type":46,"tag":77,"props":184,"children":185},{},[186],{"type":51,"value":187},"Sample documents",{"type":51,"value":189}," (for understanding data patterns):",{"type":46,"tag":137,"props":191,"children":194},{"className":192,"code":193,"language":51},[140],"mcp__mongodb__find({ database, collection, limit: 4 })\n",[195],{"type":46,"tag":93,"props":196,"children":197},{"__ignoreMap":145},[198],{"type":51,"value":193},{"type":46,"tag":83,"props":200,"children":201},{},[202,207],{"type":46,"tag":87,"props":203,"children":204},{},[205],{"type":51,"value":206},"Shows actual data values and formats",{"type":46,"tag":87,"props":208,"children":209},{},[210],{"type":51,"value":211},"Reveals common patterns (enums, ranges, etc.)",{"type":46,"tag":67,"props":213,"children":215},{"id":214},"_2-analyze-context-and-validate-fields",[216],{"type":51,"value":217},"2. Analyze Context and Validate Fields",{"type":46,"tag":54,"props":219,"children":220},{},[221],{"type":51,"value":222},"Before generating a query, always validate field names against the schema you fetched. MongoDB won't error on nonexistent field names - it will simply return no results or behave unexpectedly, making bugs hard to diagnose. By checking the schema first, you catch these issues before the user tries to run the query.",{"type":46,"tag":54,"props":224,"children":225},{},[226],{"type":51,"value":227},"Also review the available indexes to understand which query patterns will perform best.",{"type":46,"tag":67,"props":229,"children":231},{"id":230},"_3-choose-query-type-find-vs-aggregation",[232],{"type":51,"value":233},"3. Choose Query Type: Find vs Aggregation",{"type":46,"tag":54,"props":235,"children":236},{},[237],{"type":51,"value":238},"Prefer find queries over aggregation pipelines because find queries are simpler and easier for other developers to understand.",{"type":46,"tag":54,"props":240,"children":241},{},[242],{"type":46,"tag":77,"props":243,"children":244},{},[245],{"type":51,"value":246},"Use Find Query when:",{"type":46,"tag":83,"props":248,"children":249},{},[250,255,260],{"type":46,"tag":87,"props":251,"children":252},{},[253],{"type":51,"value":254},"Simple filtering on one or more fields",{"type":46,"tag":87,"props":256,"children":257},{},[258],{"type":51,"value":259},"Basic sorting, limiting, or projecting specific fields",{"type":46,"tag":87,"props":261,"children":262},{},[263],{"type":51,"value":264},"No need for grouping, complex transformations, or multi-stage processing",{"type":46,"tag":54,"props":266,"children":267},{},[268],{"type":46,"tag":77,"props":269,"children":270},{},[271],{"type":51,"value":272},"Use Aggregation Pipeline when the request requires:",{"type":46,"tag":83,"props":274,"children":275},{},[276,281,286,291],{"type":46,"tag":87,"props":277,"children":278},{},[279],{"type":51,"value":280},"Grouping or aggregation functions (sum, count, average, etc.)",{"type":46,"tag":87,"props":282,"children":283},{},[284],{"type":51,"value":285},"Multiple transformation stages",{"type":46,"tag":87,"props":287,"children":288},{},[289],{"type":51,"value":290},"Joins with other collections ($lookup)",{"type":46,"tag":87,"props":292,"children":293},{},[294],{"type":51,"value":295},"Array unwinding or complex array operations",{"type":46,"tag":67,"props":297,"children":299},{"id":298},"_4-format-your-response",[300],{"type":51,"value":301},"4. Format Your Response",{"type":46,"tag":54,"props":303,"children":304},{},[305],{"type":51,"value":306},"Output queries using the user-requested language or driver syntax; if no language or expected format is supplied, always use MongoDB shell syntax (with unquoted keys and single quotes) for readability and compatibility with MongoDB tools.",{"type":46,"tag":54,"props":308,"children":309},{},[310],{"type":46,"tag":77,"props":311,"children":312},{},[313],{"type":51,"value":314},"Find Query Response:",{"type":46,"tag":137,"props":316,"children":320},{"className":317,"code":318,"language":319,"meta":145,"style":145},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"query\": {\n    \"filter\": \"{ age: { $gte: 25 } }\",\n    \"projection\": \"{ name: 1, age: 1, _id: 0 }\",\n    \"sort\": \"{ age: -1 }\",\n    \"limit\": \"10\"\n  }\n}\n","json",[321],{"type":46,"tag":93,"props":322,"children":323},{"__ignoreMap":145},[324,336,366,409,447,485,520,529],{"type":46,"tag":325,"props":326,"children":329},"span",{"class":327,"line":328},"line",1,[330],{"type":46,"tag":325,"props":331,"children":333},{"style":332},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[334],{"type":51,"value":335},"{\n",{"type":46,"tag":325,"props":337,"children":339},{"class":327,"line":338},2,[340,345,351,356,361],{"type":46,"tag":325,"props":341,"children":342},{"style":332},[343],{"type":51,"value":344},"  \"",{"type":46,"tag":325,"props":346,"children":348},{"style":347},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[349],{"type":51,"value":350},"query",{"type":46,"tag":325,"props":352,"children":353},{"style":332},[354],{"type":51,"value":355},"\"",{"type":46,"tag":325,"props":357,"children":358},{"style":332},[359],{"type":51,"value":360},":",{"type":46,"tag":325,"props":362,"children":363},{"style":332},[364],{"type":51,"value":365}," {\n",{"type":46,"tag":325,"props":367,"children":369},{"class":327,"line":368},3,[370,375,381,385,389,394,400,404],{"type":46,"tag":325,"props":371,"children":372},{"style":332},[373],{"type":51,"value":374},"    \"",{"type":46,"tag":325,"props":376,"children":378},{"style":377},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[379],{"type":51,"value":380},"filter",{"type":46,"tag":325,"props":382,"children":383},{"style":332},[384],{"type":51,"value":355},{"type":46,"tag":325,"props":386,"children":387},{"style":332},[388],{"type":51,"value":360},{"type":46,"tag":325,"props":390,"children":391},{"style":332},[392],{"type":51,"value":393}," \"",{"type":46,"tag":325,"props":395,"children":397},{"style":396},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[398],{"type":51,"value":399},"{ age: { $gte: 25 } }",{"type":46,"tag":325,"props":401,"children":402},{"style":332},[403],{"type":51,"value":355},{"type":46,"tag":325,"props":405,"children":406},{"style":332},[407],{"type":51,"value":408},",\n",{"type":46,"tag":325,"props":410,"children":412},{"class":327,"line":411},4,[413,417,422,426,430,434,439,443],{"type":46,"tag":325,"props":414,"children":415},{"style":332},[416],{"type":51,"value":374},{"type":46,"tag":325,"props":418,"children":419},{"style":377},[420],{"type":51,"value":421},"projection",{"type":46,"tag":325,"props":423,"children":424},{"style":332},[425],{"type":51,"value":355},{"type":46,"tag":325,"props":427,"children":428},{"style":332},[429],{"type":51,"value":360},{"type":46,"tag":325,"props":431,"children":432},{"style":332},[433],{"type":51,"value":393},{"type":46,"tag":325,"props":435,"children":436},{"style":396},[437],{"type":51,"value":438},"{ name: 1, age: 1, _id: 0 }",{"type":46,"tag":325,"props":440,"children":441},{"style":332},[442],{"type":51,"value":355},{"type":46,"tag":325,"props":444,"children":445},{"style":332},[446],{"type":51,"value":408},{"type":46,"tag":325,"props":448,"children":450},{"class":327,"line":449},5,[451,455,460,464,468,472,477,481],{"type":46,"tag":325,"props":452,"children":453},{"style":332},[454],{"type":51,"value":374},{"type":46,"tag":325,"props":456,"children":457},{"style":377},[458],{"type":51,"value":459},"sort",{"type":46,"tag":325,"props":461,"children":462},{"style":332},[463],{"type":51,"value":355},{"type":46,"tag":325,"props":465,"children":466},{"style":332},[467],{"type":51,"value":360},{"type":46,"tag":325,"props":469,"children":470},{"style":332},[471],{"type":51,"value":393},{"type":46,"tag":325,"props":473,"children":474},{"style":396},[475],{"type":51,"value":476},"{ age: -1 }",{"type":46,"tag":325,"props":478,"children":479},{"style":332},[480],{"type":51,"value":355},{"type":46,"tag":325,"props":482,"children":483},{"style":332},[484],{"type":51,"value":408},{"type":46,"tag":325,"props":486,"children":488},{"class":327,"line":487},6,[489,493,498,502,506,510,515],{"type":46,"tag":325,"props":490,"children":491},{"style":332},[492],{"type":51,"value":374},{"type":46,"tag":325,"props":494,"children":495},{"style":377},[496],{"type":51,"value":497},"limit",{"type":46,"tag":325,"props":499,"children":500},{"style":332},[501],{"type":51,"value":355},{"type":46,"tag":325,"props":503,"children":504},{"style":332},[505],{"type":51,"value":360},{"type":46,"tag":325,"props":507,"children":508},{"style":332},[509],{"type":51,"value":393},{"type":46,"tag":325,"props":511,"children":512},{"style":396},[513],{"type":51,"value":514},"10",{"type":46,"tag":325,"props":516,"children":517},{"style":332},[518],{"type":51,"value":519},"\"\n",{"type":46,"tag":325,"props":521,"children":523},{"class":327,"line":522},7,[524],{"type":46,"tag":325,"props":525,"children":526},{"style":332},[527],{"type":51,"value":528},"  }\n",{"type":46,"tag":325,"props":530,"children":532},{"class":327,"line":531},8,[533],{"type":46,"tag":325,"props":534,"children":535},{"style":332},[536],{"type":51,"value":537},"}\n",{"type":46,"tag":54,"props":539,"children":540},{},[541],{"type":46,"tag":77,"props":542,"children":543},{},[544],{"type":51,"value":545},"Aggregation Pipeline Response:",{"type":46,"tag":137,"props":547,"children":549},{"className":317,"code":548,"language":319,"meta":145,"style":145},"{\n  \"aggregation\": {\n    \"pipeline\": \"[{ $match: { status: 'active' } }, { $group: { _id: '$category', total: { $sum: '$amount' } } }]\"\n  }\n}\n",[550],{"type":46,"tag":93,"props":551,"children":552},{"__ignoreMap":145},[553,560,584,617,624],{"type":46,"tag":325,"props":554,"children":555},{"class":327,"line":328},[556],{"type":46,"tag":325,"props":557,"children":558},{"style":332},[559],{"type":51,"value":335},{"type":46,"tag":325,"props":561,"children":562},{"class":327,"line":338},[563,567,572,576,580],{"type":46,"tag":325,"props":564,"children":565},{"style":332},[566],{"type":51,"value":344},{"type":46,"tag":325,"props":568,"children":569},{"style":347},[570],{"type":51,"value":571},"aggregation",{"type":46,"tag":325,"props":573,"children":574},{"style":332},[575],{"type":51,"value":355},{"type":46,"tag":325,"props":577,"children":578},{"style":332},[579],{"type":51,"value":360},{"type":46,"tag":325,"props":581,"children":582},{"style":332},[583],{"type":51,"value":365},{"type":46,"tag":325,"props":585,"children":586},{"class":327,"line":368},[587,591,596,600,604,608,613],{"type":46,"tag":325,"props":588,"children":589},{"style":332},[590],{"type":51,"value":374},{"type":46,"tag":325,"props":592,"children":593},{"style":377},[594],{"type":51,"value":595},"pipeline",{"type":46,"tag":325,"props":597,"children":598},{"style":332},[599],{"type":51,"value":355},{"type":46,"tag":325,"props":601,"children":602},{"style":332},[603],{"type":51,"value":360},{"type":46,"tag":325,"props":605,"children":606},{"style":332},[607],{"type":51,"value":393},{"type":46,"tag":325,"props":609,"children":610},{"style":396},[611],{"type":51,"value":612},"[{ $match: { status: 'active' } }, { $group: { _id: '$category', total: { $sum: '$amount' } } }]",{"type":46,"tag":325,"props":614,"children":615},{"style":332},[616],{"type":51,"value":519},{"type":46,"tag":325,"props":618,"children":619},{"class":327,"line":411},[620],{"type":46,"tag":325,"props":621,"children":622},{"style":332},[623],{"type":51,"value":528},{"type":46,"tag":325,"props":625,"children":626},{"class":327,"line":449},[627],{"type":46,"tag":325,"props":628,"children":629},{"style":332},[630],{"type":51,"value":537},{"type":46,"tag":60,"props":632,"children":634},{"id":633},"best-practices",[635],{"type":51,"value":636},"Best Practices",{"type":46,"tag":67,"props":638,"children":640},{"id":639},"query-quality",[641],{"type":51,"value":642},"Query Quality",{"type":46,"tag":123,"props":644,"children":645},{},[646,711,778,812,822,988],{"type":46,"tag":87,"props":647,"children":648},{},[649,654,656],{"type":46,"tag":77,"props":650,"children":651},{},[652],{"type":51,"value":653},"Generate correct queries",{"type":51,"value":655}," - Build queries that match user requirements, then check index coverage:\n",{"type":46,"tag":83,"props":657,"children":658},{},[659,664,669,674,687,700],{"type":46,"tag":87,"props":660,"children":661},{},[662],{"type":51,"value":663},"Generate the query to correctly satisfy all user requirements",{"type":46,"tag":87,"props":665,"children":666},{},[667],{"type":51,"value":668},"After generating the query, check if existing indexes can support it",{"type":46,"tag":87,"props":670,"children":671},{},[672],{"type":51,"value":673},"If no appropriate index exists, mention this in your response (user may want to create one)",{"type":46,"tag":87,"props":675,"children":676},{},[677,679,685],{"type":51,"value":678},"Never use ",{"type":46,"tag":93,"props":680,"children":682},{"className":681},[],[683],{"type":51,"value":684},"$where",{"type":51,"value":686}," because it prevents index usage",{"type":46,"tag":87,"props":688,"children":689},{},[690,692,698],{"type":51,"value":691},"Do not use ",{"type":46,"tag":93,"props":693,"children":695},{"className":694},[],[696],{"type":51,"value":697},"$text",{"type":51,"value":699}," without a text index",{"type":46,"tag":87,"props":701,"children":702},{},[703,709],{"type":46,"tag":93,"props":704,"children":706},{"className":705},[],[707],{"type":51,"value":708},"$expr",{"type":51,"value":710}," should only be used when necessary (use sparingly)",{"type":46,"tag":87,"props":712,"children":713},{},[714,719,721],{"type":46,"tag":77,"props":715,"children":716},{},[717],{"type":51,"value":718},"Avoid redundant operators",{"type":51,"value":720}," - Never add operators that are already implied by other conditions:\n",{"type":46,"tag":83,"props":722,"children":723},{},[724,753,773],{"type":46,"tag":87,"props":725,"children":726},{},[727,729,735,737,743,745,751],{"type":51,"value":728},"Don't add ",{"type":46,"tag":93,"props":730,"children":732},{"className":731},[],[733],{"type":51,"value":734},"$exists",{"type":51,"value":736}," when you already have an equality or inequality check (e.g., ",{"type":46,"tag":93,"props":738,"children":740},{"className":739},[],[741],{"type":51,"value":742},"status: \"active\"",{"type":51,"value":744}," or ",{"type":46,"tag":93,"props":746,"children":748},{"className":747},[],[749],{"type":51,"value":750},"age: { $gt: 25 }",{"type":51,"value":752}," already implies the field exists)",{"type":46,"tag":87,"props":754,"children":755},{},[756,758,764,765,771],{"type":51,"value":757},"Don't add overlapping range conditions (e.g., don't use both ",{"type":46,"tag":93,"props":759,"children":761},{"className":760},[],[762],{"type":51,"value":763},"$gte: 0",{"type":51,"value":100},{"type":46,"tag":93,"props":766,"children":768},{"className":767},[],[769],{"type":51,"value":770},"$gt: -1",{"type":51,"value":772},")",{"type":46,"tag":87,"props":774,"children":775},{},[776],{"type":51,"value":777},"Each condition should add meaningful filtering that isn't already covered",{"type":46,"tag":87,"props":779,"children":780},{},[781,786,788],{"type":46,"tag":77,"props":782,"children":783},{},[784],{"type":51,"value":785},"Project only needed fields",{"type":51,"value":787}," - Reduce data transfer with projections\n",{"type":46,"tag":83,"props":789,"children":790},{},[791],{"type":46,"tag":87,"props":792,"children":793},{},[794,796,802,804,810],{"type":51,"value":795},"Add ",{"type":46,"tag":93,"props":797,"children":799},{"className":798},[],[800],{"type":51,"value":801},"_id: 0",{"type":51,"value":803}," to the projection when ",{"type":46,"tag":93,"props":805,"children":807},{"className":806},[],[808],{"type":51,"value":809},"_id",{"type":51,"value":811}," field is not needed",{"type":46,"tag":87,"props":813,"children":814},{},[815,820],{"type":46,"tag":77,"props":816,"children":817},{},[818],{"type":51,"value":819},"Validate field names",{"type":51,"value":821}," against the schema before using them",{"type":46,"tag":87,"props":823,"children":824},{},[825,830,832],{"type":46,"tag":77,"props":826,"children":827},{},[828],{"type":51,"value":829},"Use appropriate operators",{"type":51,"value":831}," - Choose the right MongoDB operator for the task:\n",{"type":46,"tag":83,"props":833,"children":834},{},[835,882,900,932,951,977],{"type":46,"tag":87,"props":836,"children":837},{},[838,844,846,852,853,859,860,866,867,873,874,880],{"type":46,"tag":93,"props":839,"children":841},{"className":840},[],[842],{"type":51,"value":843},"$eq",{"type":51,"value":845},", ",{"type":46,"tag":93,"props":847,"children":849},{"className":848},[],[850],{"type":51,"value":851},"$ne",{"type":51,"value":845},{"type":46,"tag":93,"props":854,"children":856},{"className":855},[],[857],{"type":51,"value":858},"$gt",{"type":51,"value":845},{"type":46,"tag":93,"props":861,"children":863},{"className":862},[],[864],{"type":51,"value":865},"$gte",{"type":51,"value":845},{"type":46,"tag":93,"props":868,"children":870},{"className":869},[],[871],{"type":51,"value":872},"$lt",{"type":51,"value":845},{"type":46,"tag":93,"props":875,"children":877},{"className":876},[],[878],{"type":51,"value":879},"$lte",{"type":51,"value":881}," for comparisons",{"type":46,"tag":87,"props":883,"children":884},{},[885,891,892,898],{"type":46,"tag":93,"props":886,"children":888},{"className":887},[],[889],{"type":51,"value":890},"$in",{"type":51,"value":845},{"type":46,"tag":93,"props":893,"children":895},{"className":894},[],[896],{"type":51,"value":897},"$nin",{"type":51,"value":899}," for matching against a list of possible values (equivalent to multiple $eq\u002F$ne conditions OR'ed together)",{"type":46,"tag":87,"props":901,"children":902},{},[903,909,910,916,917,923,924,930],{"type":46,"tag":93,"props":904,"children":906},{"className":905},[],[907],{"type":51,"value":908},"$and",{"type":51,"value":845},{"type":46,"tag":93,"props":911,"children":913},{"className":912},[],[914],{"type":51,"value":915},"$or",{"type":51,"value":845},{"type":46,"tag":93,"props":918,"children":920},{"className":919},[],[921],{"type":51,"value":922},"$not",{"type":51,"value":845},{"type":46,"tag":93,"props":925,"children":927},{"className":926},[],[928],{"type":51,"value":929},"$nor",{"type":51,"value":931}," for logical operations",{"type":46,"tag":87,"props":933,"children":934},{},[935,941,943,949],{"type":46,"tag":93,"props":936,"children":938},{"className":937},[],[939],{"type":51,"value":940},"$regex",{"type":51,"value":942}," for case-sensitive text pattern matching (prefer left-anchored patterns like ",{"type":46,"tag":93,"props":944,"children":946},{"className":945},[],[947],{"type":51,"value":948},"\u002F^prefix\u002F",{"type":51,"value":950}," when possible, as they can use indexes efficiently)",{"type":46,"tag":87,"props":952,"children":953},{},[954,959,961,967,969,975],{"type":46,"tag":93,"props":955,"children":957},{"className":956},[],[958],{"type":51,"value":734},{"type":51,"value":960}," for field existence checks (prefer ",{"type":46,"tag":93,"props":962,"children":964},{"className":963},[],[965],{"type":51,"value":966},"a: {$ne: null}",{"type":51,"value":968}," to ",{"type":46,"tag":93,"props":970,"children":972},{"className":971},[],[973],{"type":51,"value":974},"a: {$exists: true}",{"type":51,"value":976}," to leverage available indexes)",{"type":46,"tag":87,"props":978,"children":979},{},[980,986],{"type":46,"tag":93,"props":981,"children":983},{"className":982},[],[984],{"type":51,"value":985},"$type",{"type":51,"value":987}," for type matching",{"type":46,"tag":87,"props":989,"children":990},{},[991,996,998],{"type":46,"tag":77,"props":992,"children":993},{},[994],{"type":51,"value":995},"Optimize array field checks",{"type":51,"value":997}," - Use efficient patterns for array operations:\n",{"type":46,"tag":83,"props":999,"children":1000},{},[1001,1020,1025,1036],{"type":46,"tag":87,"props":1002,"children":1003},{},[1004,1006,1012,1014],{"type":51,"value":1005},"To check if an array is non-empty: use ",{"type":46,"tag":93,"props":1007,"children":1009},{"className":1008},[],[1010],{"type":51,"value":1011},"\"arrayField.0\": {$exists: true}",{"type":51,"value":1013}," instead of ",{"type":46,"tag":93,"props":1015,"children":1017},{"className":1016},[],[1018],{"type":51,"value":1019},"arrayField: {$exists: true, $type: \"array\", $ne: []}",{"type":46,"tag":87,"props":1021,"children":1022},{},[1023],{"type":51,"value":1024},"Checking for the first element's existence is simpler, more readable, and more efficient than combining existence, type, and inequality checks",{"type":46,"tag":87,"props":1026,"children":1027},{},[1028,1030],{"type":51,"value":1029},"For matching array elements with multiple conditions, use ",{"type":46,"tag":93,"props":1031,"children":1033},{"className":1032},[],[1034],{"type":51,"value":1035},"$elemMatch",{"type":46,"tag":87,"props":1037,"children":1038},{},[1039,1041,1047],{"type":51,"value":1040},"For array length checks, use ",{"type":46,"tag":93,"props":1042,"children":1044},{"className":1043},[],[1045],{"type":51,"value":1046},"$size",{"type":51,"value":1048}," when you need an exact count",{"type":46,"tag":67,"props":1050,"children":1052},{"id":1051},"aggregation-pipeline-quality",[1053],{"type":51,"value":1054},"Aggregation Pipeline Quality",{"type":46,"tag":123,"props":1056,"children":1057},{},[1058,1076,1093,1119,1197],{"type":46,"tag":87,"props":1059,"children":1060},{},[1061,1066,1068,1074],{"type":46,"tag":77,"props":1062,"children":1063},{},[1064],{"type":51,"value":1065},"Filter early",{"type":51,"value":1067}," - Use ",{"type":46,"tag":93,"props":1069,"children":1071},{"className":1070},[],[1072],{"type":51,"value":1073},"$match",{"type":51,"value":1075}," as early as possible to reduce documents",{"type":46,"tag":87,"props":1077,"children":1078},{},[1079,1084,1085,1091],{"type":46,"tag":77,"props":1080,"children":1081},{},[1082],{"type":51,"value":1083},"Project at the end",{"type":51,"value":1067},{"type":46,"tag":93,"props":1086,"children":1088},{"className":1087},[],[1089],{"type":51,"value":1090},"$project",{"type":51,"value":1092}," at the end to correctly shape returned documents to the client",{"type":46,"tag":87,"props":1094,"children":1095},{},[1096,1101,1103,1109,1111,1117],{"type":46,"tag":77,"props":1097,"children":1098},{},[1099],{"type":51,"value":1100},"Limit when possible",{"type":51,"value":1102}," - Add ",{"type":46,"tag":93,"props":1104,"children":1106},{"className":1105},[],[1107],{"type":51,"value":1108},"$limit",{"type":51,"value":1110}," after ",{"type":46,"tag":93,"props":1112,"children":1114},{"className":1113},[],[1115],{"type":51,"value":1116},"$sort",{"type":51,"value":1118}," when appropriate",{"type":46,"tag":87,"props":1120,"children":1121},{},[1122,1127,1129,1134,1135,1140,1142],{"type":46,"tag":77,"props":1123,"children":1124},{},[1125],{"type":51,"value":1126},"Use indexes",{"type":51,"value":1128}," - Ensure ",{"type":46,"tag":93,"props":1130,"children":1132},{"className":1131},[],[1133],{"type":51,"value":1073},{"type":51,"value":100},{"type":46,"tag":93,"props":1136,"children":1138},{"className":1137},[],[1139],{"type":51,"value":1116},{"type":51,"value":1141}," stages can use indexes:\n",{"type":46,"tag":83,"props":1143,"children":1144},{},[1145,1157,1175,1187],{"type":46,"tag":87,"props":1146,"children":1147},{},[1148,1150,1155],{"type":51,"value":1149},"Place ",{"type":46,"tag":93,"props":1151,"children":1153},{"className":1152},[],[1154],{"type":51,"value":1073},{"type":51,"value":1156}," stages at the beginning of the pipeline",{"type":46,"tag":87,"props":1158,"children":1159},{},[1160,1162,1167,1168,1173],{"type":51,"value":1161},"Initial ",{"type":46,"tag":93,"props":1163,"children":1165},{"className":1164},[],[1166],{"type":51,"value":1073},{"type":51,"value":100},{"type":46,"tag":93,"props":1169,"children":1171},{"className":1170},[],[1172],{"type":51,"value":1116},{"type":51,"value":1174}," stages can use indexes if they precede any stage that modifies documents",{"type":46,"tag":87,"props":1176,"children":1177},{},[1178,1180,1185],{"type":51,"value":1179},"After generating ",{"type":46,"tag":93,"props":1181,"children":1183},{"className":1182},[],[1184],{"type":51,"value":1073},{"type":51,"value":1186}," filters, check if indexes can support them",{"type":46,"tag":87,"props":1188,"children":1189},{},[1190,1192],{"type":51,"value":1191},"Minimize stages that transform documents before first ",{"type":46,"tag":93,"props":1193,"children":1195},{"className":1194},[],[1196],{"type":51,"value":1073},{"type":46,"tag":87,"props":1198,"children":1199},{},[1200,1211],{"type":46,"tag":77,"props":1201,"children":1202},{},[1203,1205],{"type":51,"value":1204},"Optimize ",{"type":46,"tag":93,"props":1206,"children":1208},{"className":1207},[],[1209],{"type":51,"value":1210},"$lookup",{"type":51,"value":1212}," - Consider denormalization for frequently joined data",{"type":46,"tag":67,"props":1214,"children":1216},{"id":1215},"error-prevention",[1217],{"type":51,"value":1218},"Error Prevention",{"type":46,"tag":123,"props":1220,"children":1221},{},[1222,1232,1242,1252,1262],{"type":46,"tag":87,"props":1223,"children":1224},{},[1225,1230],{"type":46,"tag":77,"props":1226,"children":1227},{},[1228],{"type":51,"value":1229},"Validate all field references",{"type":51,"value":1231}," against the schema",{"type":46,"tag":87,"props":1233,"children":1234},{},[1235,1240],{"type":46,"tag":77,"props":1236,"children":1237},{},[1238],{"type":51,"value":1239},"Quote field names correctly",{"type":51,"value":1241}," - Use dot notation for nested fields",{"type":46,"tag":87,"props":1243,"children":1244},{},[1245,1250],{"type":46,"tag":77,"props":1246,"children":1247},{},[1248],{"type":51,"value":1249},"Escape special characters",{"type":51,"value":1251}," in regex patterns",{"type":46,"tag":87,"props":1253,"children":1254},{},[1255,1260],{"type":46,"tag":77,"props":1256,"children":1257},{},[1258],{"type":51,"value":1259},"Check data types",{"type":51,"value":1261}," - Ensure field values match field types from schema",{"type":46,"tag":87,"props":1263,"children":1264},{},[1265,1270,1272,1278,1279,1285],{"type":46,"tag":77,"props":1266,"children":1267},{},[1268],{"type":51,"value":1269},"Geospatial coordinates",{"type":51,"value":1271}," - MongoDB's GeoJSON format requires longitude first, then latitude (e.g., ",{"type":46,"tag":93,"props":1273,"children":1275},{"className":1274},[],[1276],{"type":51,"value":1277},"[longitude, latitude]",{"type":51,"value":744},{"type":46,"tag":93,"props":1280,"children":1282},{"className":1281},[],[1283],{"type":51,"value":1284},"{type: \"Point\", coordinates: [lng, lat]}",{"type":51,"value":1286},"). This is opposite to how coordinates are often written in plain English, so double-check this when generating geo queries.",{"type":46,"tag":60,"props":1288,"children":1290},{"id":1289},"schema-analysis",[1291],{"type":51,"value":1292},"Schema Analysis",{"type":46,"tag":54,"props":1294,"children":1295},{},[1296],{"type":51,"value":1297},"When provided with sample documents, analyze:",{"type":46,"tag":123,"props":1299,"children":1300},{},[1301,1311,1321,1331,1341],{"type":46,"tag":87,"props":1302,"children":1303},{},[1304,1309],{"type":46,"tag":77,"props":1305,"children":1306},{},[1307],{"type":51,"value":1308},"Field types",{"type":51,"value":1310}," - String, Number, Boolean, Date, ObjectId, Array, Object",{"type":46,"tag":87,"props":1312,"children":1313},{},[1314,1319],{"type":46,"tag":77,"props":1315,"children":1316},{},[1317],{"type":51,"value":1318},"Field patterns",{"type":51,"value":1320}," - Required vs optional fields (check multiple samples)",{"type":46,"tag":87,"props":1322,"children":1323},{},[1324,1329],{"type":46,"tag":77,"props":1325,"children":1326},{},[1327],{"type":51,"value":1328},"Nested structures",{"type":51,"value":1330}," - Objects within objects, arrays of objects",{"type":46,"tag":87,"props":1332,"children":1333},{},[1334,1339],{"type":46,"tag":77,"props":1335,"children":1336},{},[1337],{"type":51,"value":1338},"Array elements",{"type":51,"value":1340}," - Homogeneous vs heterogeneous arrays",{"type":46,"tag":87,"props":1342,"children":1343},{},[1344,1349],{"type":46,"tag":77,"props":1345,"children":1346},{},[1347],{"type":51,"value":1348},"Special types",{"type":51,"value":1350}," - Dates, ObjectIds, Binary data, GeoJSON",{"type":46,"tag":60,"props":1352,"children":1354},{"id":1353},"sample-document-usage",[1355],{"type":51,"value":1356},"Sample Document Usage",{"type":46,"tag":54,"props":1358,"children":1359},{},[1360],{"type":51,"value":1361},"Use sample documents to:",{"type":46,"tag":83,"props":1363,"children":1364},{},[1365,1370,1375,1380,1385],{"type":46,"tag":87,"props":1366,"children":1367},{},[1368],{"type":51,"value":1369},"Understand actual data values and ranges",{"type":46,"tag":87,"props":1371,"children":1372},{},[1373],{"type":51,"value":1374},"Identify field naming conventions (camelCase, snake_case, etc.)",{"type":46,"tag":87,"props":1376,"children":1377},{},[1378],{"type":51,"value":1379},"Detect common patterns (e.g., status enums, category values)",{"type":46,"tag":87,"props":1381,"children":1382},{},[1383],{"type":51,"value":1384},"Estimate cardinality for grouping operations",{"type":46,"tag":87,"props":1386,"children":1387},{},[1388],{"type":51,"value":1389},"Validate that your query will work with real data",{"type":46,"tag":60,"props":1391,"children":1393},{"id":1392},"error-handling",[1394],{"type":51,"value":1395},"Error Handling",{"type":46,"tag":54,"props":1397,"children":1398},{},[1399],{"type":51,"value":1400},"If you cannot generate a query:",{"type":46,"tag":123,"props":1402,"children":1403},{},[1404,1414,1424,1434],{"type":46,"tag":87,"props":1405,"children":1406},{},[1407,1412],{"type":46,"tag":77,"props":1408,"children":1409},{},[1410],{"type":51,"value":1411},"Explain why",{"type":51,"value":1413}," - Missing schema, ambiguous request, impossible query",{"type":46,"tag":87,"props":1415,"children":1416},{},[1417,1422],{"type":46,"tag":77,"props":1418,"children":1419},{},[1420],{"type":51,"value":1421},"Ask for clarification",{"type":51,"value":1423}," - Request more details about requirements",{"type":46,"tag":87,"props":1425,"children":1426},{},[1427,1432],{"type":46,"tag":77,"props":1428,"children":1429},{},[1430],{"type":51,"value":1431},"Suggest alternatives",{"type":51,"value":1433}," - Propose different approaches if available",{"type":46,"tag":87,"props":1435,"children":1436},{},[1437,1442],{"type":46,"tag":77,"props":1438,"children":1439},{},[1440],{"type":51,"value":1441},"Provide examples",{"type":51,"value":1443}," - Show similar queries that could work",{"type":46,"tag":60,"props":1445,"children":1447},{"id":1446},"example-workflow",[1448],{"type":51,"value":1449},"Example Workflow",{"type":46,"tag":54,"props":1451,"children":1452},{},[1453,1458],{"type":46,"tag":77,"props":1454,"children":1455},{},[1456],{"type":51,"value":1457},"User Input:",{"type":51,"value":1459}," \"Find all active users over 25 years old, sorted by registration date\"",{"type":46,"tag":54,"props":1461,"children":1462},{},[1463],{"type":46,"tag":77,"props":1464,"children":1465},{},[1466],{"type":51,"value":1467},"Your Process:",{"type":46,"tag":123,"props":1469,"children":1470},{},[1471,1498,1503,1508,1513],{"type":46,"tag":87,"props":1472,"children":1473},{},[1474,1476,1482,1483,1489,1490,1496],{"type":51,"value":1475},"Check schema for fields: ",{"type":46,"tag":93,"props":1477,"children":1479},{"className":1478},[],[1480],{"type":51,"value":1481},"status",{"type":51,"value":845},{"type":46,"tag":93,"props":1484,"children":1486},{"className":1485},[],[1487],{"type":51,"value":1488},"age",{"type":51,"value":845},{"type":46,"tag":93,"props":1491,"children":1493},{"className":1492},[],[1494],{"type":51,"value":1495},"registrationDate",{"type":51,"value":1497}," or similar",{"type":46,"tag":87,"props":1499,"children":1500},{},[1501],{"type":51,"value":1502},"Verify field types match the query requirements",{"type":46,"tag":87,"props":1504,"children":1505},{},[1506],{"type":51,"value":1507},"Generate query based on user requirements",{"type":46,"tag":87,"props":1509,"children":1510},{},[1511],{"type":51,"value":1512},"Check if available indexes can support the query",{"type":46,"tag":87,"props":1514,"children":1515},{},[1516],{"type":51,"value":1517},"Suggest creating an index if no appropriate index exists for the query filters",{"type":46,"tag":54,"props":1519,"children":1520},{},[1521],{"type":46,"tag":77,"props":1522,"children":1523},{},[1524],{"type":51,"value":1525},"Generated Query:",{"type":46,"tag":137,"props":1527,"children":1529},{"className":317,"code":1528,"language":319,"meta":145,"style":145},"{\n  \"query\": {\n    \"filter\": \"{ status: 'active', age: { $gt: 25 } }\",\n    \"sort\": \"{ registrationDate: -1 }\"\n  }\n}\n",[1530],{"type":46,"tag":93,"props":1531,"children":1532},{"__ignoreMap":145},[1533,1540,1563,1599,1631,1638],{"type":46,"tag":325,"props":1534,"children":1535},{"class":327,"line":328},[1536],{"type":46,"tag":325,"props":1537,"children":1538},{"style":332},[1539],{"type":51,"value":335},{"type":46,"tag":325,"props":1541,"children":1542},{"class":327,"line":338},[1543,1547,1551,1555,1559],{"type":46,"tag":325,"props":1544,"children":1545},{"style":332},[1546],{"type":51,"value":344},{"type":46,"tag":325,"props":1548,"children":1549},{"style":347},[1550],{"type":51,"value":350},{"type":46,"tag":325,"props":1552,"children":1553},{"style":332},[1554],{"type":51,"value":355},{"type":46,"tag":325,"props":1556,"children":1557},{"style":332},[1558],{"type":51,"value":360},{"type":46,"tag":325,"props":1560,"children":1561},{"style":332},[1562],{"type":51,"value":365},{"type":46,"tag":325,"props":1564,"children":1565},{"class":327,"line":368},[1566,1570,1574,1578,1582,1586,1591,1595],{"type":46,"tag":325,"props":1567,"children":1568},{"style":332},[1569],{"type":51,"value":374},{"type":46,"tag":325,"props":1571,"children":1572},{"style":377},[1573],{"type":51,"value":380},{"type":46,"tag":325,"props":1575,"children":1576},{"style":332},[1577],{"type":51,"value":355},{"type":46,"tag":325,"props":1579,"children":1580},{"style":332},[1581],{"type":51,"value":360},{"type":46,"tag":325,"props":1583,"children":1584},{"style":332},[1585],{"type":51,"value":393},{"type":46,"tag":325,"props":1587,"children":1588},{"style":396},[1589],{"type":51,"value":1590},"{ status: 'active', age: { $gt: 25 } }",{"type":46,"tag":325,"props":1592,"children":1593},{"style":332},[1594],{"type":51,"value":355},{"type":46,"tag":325,"props":1596,"children":1597},{"style":332},[1598],{"type":51,"value":408},{"type":46,"tag":325,"props":1600,"children":1601},{"class":327,"line":411},[1602,1606,1610,1614,1618,1622,1627],{"type":46,"tag":325,"props":1603,"children":1604},{"style":332},[1605],{"type":51,"value":374},{"type":46,"tag":325,"props":1607,"children":1608},{"style":377},[1609],{"type":51,"value":459},{"type":46,"tag":325,"props":1611,"children":1612},{"style":332},[1613],{"type":51,"value":355},{"type":46,"tag":325,"props":1615,"children":1616},{"style":332},[1617],{"type":51,"value":360},{"type":46,"tag":325,"props":1619,"children":1620},{"style":332},[1621],{"type":51,"value":393},{"type":46,"tag":325,"props":1623,"children":1624},{"style":396},[1625],{"type":51,"value":1626},"{ registrationDate: -1 }",{"type":46,"tag":325,"props":1628,"children":1629},{"style":332},[1630],{"type":51,"value":519},{"type":46,"tag":325,"props":1632,"children":1633},{"class":327,"line":449},[1634],{"type":46,"tag":325,"props":1635,"children":1636},{"style":332},[1637],{"type":51,"value":528},{"type":46,"tag":325,"props":1639,"children":1640},{"class":327,"line":487},[1641],{"type":46,"tag":325,"props":1642,"children":1643},{"style":332},[1644],{"type":51,"value":537},{"type":46,"tag":60,"props":1646,"children":1648},{"id":1647},"managing-context-size",[1649],{"type":51,"value":1650},"Managing Context Size",{"type":46,"tag":54,"props":1652,"children":1653},{},[1654],{"type":51,"value":1655},"Fetching large or numerous sample documents wastes context and can degrade query quality.",{"type":46,"tag":54,"props":1657,"children":1658},{},[1659],{"type":46,"tag":77,"props":1660,"children":1661},{},[1662],{"type":51,"value":1663},"Adjust sample count by schema width:",{"type":46,"tag":83,"props":1665,"children":1666},{},[1667,1680,1691,1702],{"type":46,"tag":87,"props":1668,"children":1669},{},[1670,1672,1678],{"type":51,"value":1671},"\u003C 30 fields: ",{"type":46,"tag":93,"props":1673,"children":1675},{"className":1674},[],[1676],{"type":51,"value":1677},"limit: 4",{"type":51,"value":1679}," (default)",{"type":46,"tag":87,"props":1681,"children":1682},{},[1683,1685],{"type":51,"value":1684},"30–80 fields: ",{"type":46,"tag":93,"props":1686,"children":1688},{"className":1687},[],[1689],{"type":51,"value":1690},"limit: 2",{"type":46,"tag":87,"props":1692,"children":1693},{},[1694,1696],{"type":51,"value":1695},"80–150 fields: ",{"type":46,"tag":93,"props":1697,"children":1699},{"className":1698},[],[1700],{"type":51,"value":1701},"limit: 1",{"type":46,"tag":87,"props":1703,"children":1704},{},[1705,1707,1712],{"type":51,"value":1706},"150+ fields: ",{"type":46,"tag":93,"props":1708,"children":1710},{"className":1709},[],[1711],{"type":51,"value":1701},{"type":51,"value":1713}," with a projection of only the fields relevant to the user's query",{"type":46,"tag":54,"props":1715,"children":1716},{},[1717],{"type":46,"tag":77,"props":1718,"children":1719},{},[1720],{"type":51,"value":1721},"Preview large array fields and strings:",{"type":46,"tag":83,"props":1723,"children":1724},{},[1725],{"type":46,"tag":87,"props":1726,"children":1727},{},[1728,1730,1736,1738,1744],{"type":51,"value":1729},"If schema documents contains arrays, use ",{"type":46,"tag":93,"props":1731,"children":1733},{"className":1732},[],[1734],{"type":51,"value":1735},"$slice: 3",{"type":51,"value":1737}," in the sample projection to cap array size. Limit string fields to 100 characters with ",{"type":46,"tag":93,"props":1739,"children":1741},{"className":1740},[],[1742],{"type":51,"value":1743},"$substr",{"type":51,"value":1745}," in the sample projection to prevent excessively long values from consuming context.",{"type":46,"tag":1747,"props":1748,"children":1749},"style",{},[1750],{"type":51,"value":1751},"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":1753,"total":1877},[1754,1769,1781,1794,1800,1813,1826,1843,1860],{"slug":1755,"name":1755,"fn":1756,"description":1757,"org":1758,"tags":1759,"stars":20,"repoUrl":21,"updatedAt":1768},"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},[1760,1763,1766,1767],{"name":1761,"slug":1762,"type":13},"Data Engineering","data-engineering",{"name":1764,"slug":1765,"type":13},"Data Pipeline","data-pipeline",{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},"2026-07-13T06:15:32.953796",{"slug":1770,"name":1770,"fn":1771,"description":1772,"org":1773,"tags":1774,"stars":20,"repoUrl":21,"updatedAt":1780},"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},[1775,1776,1777],{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},{"name":1778,"slug":1779,"type":13},"Performance","performance","2026-07-13T06:15:26.144554",{"slug":1782,"name":1782,"fn":1783,"description":1784,"org":1785,"tags":1786,"stars":20,"repoUrl":21,"updatedAt":1793},"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},[1787,1790,1792],{"name":1788,"slug":1789,"type":13},"Configuration","configuration",{"name":1791,"slug":30,"type":13},"MCP",{"name":9,"slug":8,"type":13},"2026-07-16T06:00:24.26424",{"slug":4,"name":4,"fn":5,"description":6,"org":1795,"tags":1796,"stars":20,"repoUrl":21,"updatedAt":22},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1797,1798,1799],{"name":15,"slug":16,"type":13},{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},{"slug":1801,"name":1801,"fn":1802,"description":1803,"org":1804,"tags":1805,"stars":20,"repoUrl":21,"updatedAt":1812},"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},[1806,1807,1810,1811],{"name":18,"slug":19,"type":13},{"name":1808,"slug":1809,"type":13},"Debugging","debugging",{"name":9,"slug":8,"type":13},{"name":1778,"slug":1779,"type":13},"2026-07-13T06:15:44.51826",{"slug":1814,"name":1814,"fn":1815,"description":1816,"org":1817,"tags":1818,"stars":20,"repoUrl":21,"updatedAt":1825},"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},[1819,1822,1823,1824],{"name":1820,"slug":1821,"type":13},"Data Modeling","data-modeling",{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},{"name":1778,"slug":1779,"type":13},"2026-07-16T06:00:24.782785",{"slug":1827,"name":1827,"fn":1828,"description":1829,"org":1830,"tags":1831,"stars":20,"repoUrl":21,"updatedAt":1842},"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},[1832,1835,1836,1839],{"name":1833,"slug":1834,"type":13},"LLM","llm",{"name":9,"slug":8,"type":13},{"name":1837,"slug":1838,"type":13},"RAG","rag",{"name":1840,"slug":1841,"type":13},"Search","search","2026-07-16T06:01:58.645908",{"slug":1844,"name":1844,"fn":1845,"description":1846,"org":1847,"tags":1848,"stars":1857,"repoUrl":1858,"updatedAt":1859},"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},[1849,1850,1853,1856],{"name":1764,"slug":1765,"type":13},{"name":1851,"slug":1852,"type":13},"ETL","etl",{"name":1854,"slug":1855,"type":13},"Migration","migration",{"name":9,"slug":8,"type":13},10,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002FASP_example","2026-07-16T06:02:02.15744",{"slug":1861,"name":1861,"fn":1862,"description":1863,"org":1864,"tags":1865,"stars":328,"repoUrl":1875,"updatedAt":1876},"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},[1866,1869,1872],{"name":1867,"slug":1868,"type":13},"Automation","automation",{"name":1870,"slug":1871,"type":13},"Security","security",{"name":1873,"slug":1874,"type":13},"Workflow Automation","workflow-automation","https:\u002F\u002Fgithub.com\u002Fmongodb\u002Ftines-claude","2026-07-13T06:15:24.618317",9,{"items":1879,"total":522},[1880,1887,1893,1899,1905,1912,1919],{"slug":1755,"name":1755,"fn":1756,"description":1757,"org":1881,"tags":1882,"stars":20,"repoUrl":21,"updatedAt":1768},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1883,1884,1885,1886],{"name":1761,"slug":1762,"type":13},{"name":1764,"slug":1765,"type":13},{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},{"slug":1770,"name":1770,"fn":1771,"description":1772,"org":1888,"tags":1889,"stars":20,"repoUrl":21,"updatedAt":1780},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1890,1891,1892],{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},{"name":1778,"slug":1779,"type":13},{"slug":1782,"name":1782,"fn":1783,"description":1784,"org":1894,"tags":1895,"stars":20,"repoUrl":21,"updatedAt":1793},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1896,1897,1898],{"name":1788,"slug":1789,"type":13},{"name":1791,"slug":30,"type":13},{"name":9,"slug":8,"type":13},{"slug":4,"name":4,"fn":5,"description":6,"org":1900,"tags":1901,"stars":20,"repoUrl":21,"updatedAt":22},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1902,1903,1904],{"name":15,"slug":16,"type":13},{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},{"slug":1801,"name":1801,"fn":1802,"description":1803,"org":1906,"tags":1907,"stars":20,"repoUrl":21,"updatedAt":1812},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1908,1909,1910,1911],{"name":18,"slug":19,"type":13},{"name":1808,"slug":1809,"type":13},{"name":9,"slug":8,"type":13},{"name":1778,"slug":1779,"type":13},{"slug":1814,"name":1814,"fn":1815,"description":1816,"org":1913,"tags":1914,"stars":20,"repoUrl":21,"updatedAt":1825},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1915,1916,1917,1918],{"name":1820,"slug":1821,"type":13},{"name":18,"slug":19,"type":13},{"name":9,"slug":8,"type":13},{"name":1778,"slug":1779,"type":13},{"slug":1827,"name":1827,"fn":1828,"description":1829,"org":1920,"tags":1921,"stars":20,"repoUrl":21,"updatedAt":1842},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1922,1923,1924,1925],{"name":1833,"slug":1834,"type":13},{"name":9,"slug":8,"type":13},{"name":1837,"slug":1838,"type":13},{"name":1840,"slug":1841,"type":13}]