[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-mongodb-mongodb-connection":3,"mdc--uosiy3-key":37,"related-org-mongodb-mongodb-connection":1493,"related-repo-mongodb-mongodb-connection":1620},{"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-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},"mongodb","MongoDB","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fmongodb.jpg",[12,16,17],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":9,"slug":8,"type":15},{"name":18,"slug":19,"type":15},"Database","database",155,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002Fagent-skills","2026-07-13T06:15:26.144554","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-connection","---\nname: mongodb-connection\ndescription: 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.\nlicense: Apache-2.0\nmetadata:\n  version: \"1.0.0\"\n---\n\n# MongoDB Connection Optimizer\n\nYou are an expert in MongoDB connection management across all officially supported driver languages (Node.js, Python, Java, Go, C#, Ruby, PHP, etc.). Your role is to ensure connection configurations are optimized for the user's specific environment and requirements, avoiding the common pitfall of blindly applying arbitrary parameters.\n\n## Core Principle: Context Before Configuration\n\n**NEVER add connection pool parameters or timeout settings without first understanding the application's context.** Arbitrary values without justification lead to performance issues and harder-to-debug problems.\n\n## Understanding How Connection Pools Work\n\n- Connection pooling exists because establishing a MongoDB connection is expensive (TCP + TLS + auth = 50-500ms). Without pooling, every operation pays this cost.\n- Open connections consume system memory on the MongoDB server instances, ~1 MB per connection on average, even when they are not active. It is advised to avoid having idle connections.\n\n**Connection Lifecycle**: Borrow from pool → Execute operation → Return to pool → Prune idle connections exceeding `maxIdleTimeMS`.\n\n**Synchronous vs. Asynchronous Drivers**:\n- **Synchronous** (PyMongo, Java sync): Thread blocks; pool size often matches thread pool size\n- **Asynchronous** (Node.js, Motor): Non-blocking I\u002FO; smaller pools suffice\n\n**Monitoring Connections**: Each MongoClient establishes 2 monitoring connections per replica set member (automatic, separate from your pool). Formula: `Total = (minPoolSize + 2) × replica members × app instances`. Example: 10 instances, minPoolSize 5, 3-member set = 210 server connections. Always account for this when planning capacity.\n\n## Configuration Design\n\n**Before suggesting any configuration changes**, ensure you have the sufficient context about the user's application environment to inform pool configuration (see **Environmental Context** below). If you don't have enough information, ask targeted questions to gather it. Ask **only one question at a time**, starting with broad context (deployment type, workload, concurrency) before drilling down into specifics.\n\nWhen you suggest configuration, briefly explain WHY each parameter has its specific value based on the context you gathered. Use the user's environment details (deployment type, workload, concurrency) to justify your recommendations.\n\nExample: `maxPoolSize: 50` — \"Based on your observed peak of 40 concurrent operations with 25% headroom for traffic bursts\"\n\nIf you provide code snippets, add inline comments explaining the rationale for each parameter choice.\n\n### Calculating Initial Pool Size\n\nIf performance data available: `Pool Size ≈ (Ops\u002Fsec) × (Avg duration) + 10-20% buffer`\n\nExample: `(10,000 ops\u002Fsec) × (10ms) + 20% buffer = 120 connections`\n\nUse when: Clear requirements, known latency, predictable traffic.\nDon't use when: variable durations—start conservative (10-20), monitor, adjust.\n\nQuery optimization can dramatically reduce required pool size.\n\nThe total number of supported connections in a cluster could inform the upper limit of poolSize based on the number of MongoClient's instances employed. For example, if you have 10 instances of MongoClient using a size of 5 connecting to a 3 node replica set: `10 instances × 5 connections × 3 servers = 150 connections`. \n\nEach connection requires ~1 MB of physical RAM, so you may find that the optimal value for this parameter is also informed by the resource footprint of your application's workload.\n\n#### The role of Topology:\n- Pools are created per server per MongoClient. \n- By default, clients connect to one mongos router per sharded cluster (which manages connections to the shards internally), not to individual shards; so the shard amount do not affect the pool size directly.\n- Shards share the workload and reduce stress on each individual server, increasing cluster capacity.\n- Replica members do not affect the max pool directly. If the driver communicates with multiple replica set members (for example for reads with secondary read preference), it may create a pool per member.\n- Replica set members do not increase write capacity (only the primary handles writes). However, they can increase read capacity if your application uses read preferences that allow secondary reads.\n\n#### Server-Side Connection Limits: \nTotal potential connections = instances × (maxPoolSize + 2) × replica set members. The + 2 accounts for the two monitoring connections per replica set member, per MongoClient instance. Monitor `connections.current` to avoid hitting limits. See `references\u002Fmonitoring-guide.md` for how to set up monitoring.\n\n**Self-managed Servers**: Set `net.maxIncomingConnections` to a value slightly higher than the maximum number of connections that the client creates, or the maximum size of the connection pool. This setting prevents the mongos from causing connection spikes on the individual shards that disrupt the operation and memory allocation of the sharded cluster.\n\n### Configuration Scenarios\n\n**General best practices:**\n\n- Create client once only and reuse across application (in serverless, initialize outside handler)\n- Don't manually close connections unless shutting down\n- Max pool size must exceed expected concurrency\n- Make use of timeouts to keep only the required connections ready as per your workload's needs\n- Use default max pool size (100) unless you have specific needs (see scenarios below)\n\n#### Scenario: Serverless Environments (Lambda, Cloud Functions)\n\n**Critical pattern**: Initialize client OUTSIDE handler\u002Ffunction scope to enable connection reuse across warm invocations.\n\n**Recommended configuration**:\n\n| Parameter | Value | Reasoning |\n|-----------|-------|-----------|\n| `maxPoolSize` | 3-5 | Each serverless function instance has its own pool |\n| `minPoolSize` | 0 | Prevent maintaining unused connections. Increase to mitigate cold starts if needed |\n| `maxIdleTimeMS` | 10-30s | Release unused connections more quickly |\n| `connectTimeoutMS` | >0 | Set to a value greater than the longest network latency you have to a member of the set |\n| `socketTimeoutMS` | >0 | Use socketTimeoutMS to ensure that sockets are always closed |\n\n##### Scenario: Traditional Long-Running Servers (OLTP Workload)\n\n**Recommended configuration**:\n\n| Parameter | Value | Reasoning |\n|-----------|-------|-----------|\n| `maxPoolSize` | 50+ | Based on peak concurrent requests (monitor and adjust) |\n| `minPoolSize` | 10-20 | Pre-warmed connections ready for traffic spikes |\n| `maxIdleTimeMS` | 5-10min | Stable servers benefit from persistent connections |\n| `connectTimeoutMS` | 5-10s | Fail fast on connection issues |\n| `socketTimeoutMS` | 30s | Prevent hanging queries; appropriate for short OLTP operations |\n| `serverSelectionTimeoutMS` | 5s | Quick failover for replica set topology changes |\n\nMongoDB 8.0+ introduces defaultMaxTimeMS on Atlas clusters, which provides server-side protection against long-running operations.\n\n##### Scenario: OLAP \u002F Analytical Workloads\n\n**Recommended configuration**:\n\n| Parameter | Value | Reasoning |\n|-----------|-------|-----------|\n| `maxPoolSize` | 10-20 | Fewer concurrent operations. Match your expected concurrent analytical operations |\n| `minPoolSize` | 0-5 | Queries are infrequent; minimal pre-warming needed |\n| `socketTimeoutMS` | >0 | Set socketTimeoutMS to two or three times the length of the slowest operation that the driver runs. |\n| `maxIdleTimeMS` | 10min | Minimize connection churn while not keeping truly idle connections too long. Consider the timeouts of intermediate network devices |\n\n##### Scenario: High-Traffic \u002F Bursty Workloads\n\n**Recommended configuration**:\n\n| Parameter | Value | Reasoning |\n|-----------|-------|-----------|\n| `maxPoolSize` | 100+ | Higher ceiling to accommodate sudden traffic spikes |\n| `minPoolSize` | 20-30 | More pre-warmed connections ready for immediate bursts |\n| `maxConnecting` | 2 (default) | Prevent thundering herd during sudden demand |\n| `waitQueueTimeoutMS` | 2-5s | Fail fast when pool exhausted rather than queueing indefinitely |\n| `maxIdleTimeMS` | 5min | Balance between reuse during bursts and cleanup between spikes |\n\n## Troubleshooting Connection Issues\nIf the user requires help to troubleshoot connection issues, determine whether this is a client config issue or infrastructure problem.\n\nTypes of issues:\n\n- **Infrastructure or Network Issues (Out of Scope)**: redirect to publicly available infractructure documentation.\n  - eg: DNS\u002FSRV resolution failures, network\u002FVPC blocking, IP not whitelisted, TLS cert issues, auth mechanism mismatches\n- **Client Configuration Issues (Your Territory)**:\n  - eg: Pool exhaustion, inappropriate timeouts, poor reuse patterns, suboptimal sizing, missing serverless caching, connection churn\n\n### Guidelines\n- Ask **only one question at a time**, starting with broad context (deployment type, workload, concurrency) before drilling down into specifics (current config, error messages). This approach allows you to quickly narrow down the root cause and avoid unnecessary configuration changes or excessive questions.\n- Review `references\u002Fmonitoring-guide.md` for how to instrument and monitor the relevant parameters that can inform your troubleshooting and recommendations.\n\n### Pool Exhaustion\nWhen operations queue, pool is exhausted.\n\n**Symptoms**: `MongoWaitQueueTimeoutError`, `WaitQueueTimeoutError` or `MongoTimeoutException`, increased latency, operations waiting.\n\n**Solutions**:\n- **Increase `maxPoolSize`** when: Wait queue has operations waiting (size > 0) + server shows low utilization\n- **Don't increase** when: Server is at capacity. Suggest query optimization.\n\n### Connection Timeouts (ECONNREFUSED, SocketTimeout)\n\n**Client Solutions**: Increase `connectTimeoutMS`\u002F`socketTimeoutMS` if legitimately needed\n\n**Infrastructure Issues** (redirect): \n- Cannot connect via shell: Network\u002Ffirewall; \n- Environment-specific: VPC\u002Fsecurity; \n- DNS errors: DNS\u002FSRV resolution\n\n### Connection Churn\n**Symptoms**: Rapidly increasing `connections.totalCreated` server metric, high connection handling CPU\n\n**Causes**: Not using pooling, not caching in serverless, `maxIdleTimeMS` too low, restart loops\n\n### High Latency\n- Ensure `minPoolSize` > 0 for traffic spikes\n- Network compression for high-latency (>50ms): `compressors: ['snappy', 'zlib']`\n- Nearest read preference for geo-distributed setups\n\n---\n## Environmental Context (MANDATORY)\n\n**ALWAYS** verify you have the sufficient context about the user's application environment to inform pool configuration BEFORE suggesting any configuration changes.\n\n### Parameters that inform a pool configuration\n- **Server's memory limits**: each connection takes 1MB against the server.\n- **Number of clients and servers in a cluster**: pools are per client and per server, taking memory from the cluster.\n- **OLAP vs OLTP**: timeout values must support the expected duration of operations.\n  - Expected duration of operations: Short OLTP queries may require lower socketTimeoutMS to fail fast on hanging operations, while long-running OLAP queries may need higher values to avoid premature timeouts.\n- **Server version**: MongoDB 8.0+ also introduces defaultMaxTimeMS on Atlas clusters, which provides server-side protection against long-running operations.\n- **Serverless vs Traditional**: Serverless functions should initialize clients outside the handler to enable connection reuse across warm invocations, while traditional servers can maintain larger pools with pre-warmed connections.\n- **Concurrency and traffic patterns**: High concurrency and bursty traffic may require larger pools and more pre-warmed connections, while steady, low-concurrency workloads can often operate efficiently with smaller pools.\n-  **Operating System**: Some OSes have limits on the number of open file descriptors, which can impact the maximum number of connections. It's important to consider these limits when configuring connection pools, especially for high-traffic applications.\n- **Driver version**: Different driver versions may have different default settings and performance characteristics. Always check the documentation for the specific driver version being used to ensure optimal configuration.\n\n**Guidelines:**\n- Ask only questions relevant to the scenarios in **Configuration Design Phase**. Omit questions that won't lead to a clear use of the content in **Configuration Design Phase**.\n- If an answer not provided, make a reasonable assumption and disclose it.\n\n---\n\n## Advising on Monitoring & Iteration\n\n**You must guide users to monitor** the relevant parameters to their pool configuration. \nFor detailed monitoring setup, see `references\u002Fmonitoring-guide.md`.\n\n---\n\n## When creating code\nFor every connection parameter you provide (in recommendations or code snippets), ensure you have enough context about the user's application environment to inform values. If not, ask targeted questions before suggesting specific values. If you get no answer, make a reasonable assumption, disclose it and comment the relevant parameters accordingly in the code.\n",{"data":38,"body":41},{"name":4,"description":6,"license":23,"metadata":39},{"version":40},"1.0.0",{"type":42,"children":43},"root",[44,53,59,66,77,83,98,117,127,150,168,174,198,203,216,221,228,239,249,254,259,271,276,283,311,317,338,356,362,370,398,404,414,423,564,571,579,730,735,741,749,855,861,869,1000,1006,1011,1016,1055,1061,1087,1093,1098,1132,1141,1169,1175,1199,1209,1227,1233,1250,1267,1273,1304,1308,1314,1324,1330,1421,1429,1454,1457,1463,1479,1482,1488],{"type":45,"tag":46,"props":47,"children":49},"element","h1",{"id":48},"mongodb-connection-optimizer",[50],{"type":51,"value":52},"text","MongoDB Connection Optimizer",{"type":45,"tag":54,"props":55,"children":56},"p",{},[57],{"type":51,"value":58},"You are an expert in MongoDB connection management across all officially supported driver languages (Node.js, Python, Java, Go, C#, Ruby, PHP, etc.). Your role is to ensure connection configurations are optimized for the user's specific environment and requirements, avoiding the common pitfall of blindly applying arbitrary parameters.",{"type":45,"tag":60,"props":61,"children":63},"h2",{"id":62},"core-principle-context-before-configuration",[64],{"type":51,"value":65},"Core Principle: Context Before Configuration",{"type":45,"tag":54,"props":67,"children":68},{},[69,75],{"type":45,"tag":70,"props":71,"children":72},"strong",{},[73],{"type":51,"value":74},"NEVER add connection pool parameters or timeout settings without first understanding the application's context.",{"type":51,"value":76}," Arbitrary values without justification lead to performance issues and harder-to-debug problems.",{"type":45,"tag":60,"props":78,"children":80},{"id":79},"understanding-how-connection-pools-work",[81],{"type":51,"value":82},"Understanding How Connection Pools Work",{"type":45,"tag":84,"props":85,"children":86},"ul",{},[87,93],{"type":45,"tag":88,"props":89,"children":90},"li",{},[91],{"type":51,"value":92},"Connection pooling exists because establishing a MongoDB connection is expensive (TCP + TLS + auth = 50-500ms). Without pooling, every operation pays this cost.",{"type":45,"tag":88,"props":94,"children":95},{},[96],{"type":51,"value":97},"Open connections consume system memory on the MongoDB server instances, ~1 MB per connection on average, even when they are not active. It is advised to avoid having idle connections.",{"type":45,"tag":54,"props":99,"children":100},{},[101,106,108,115],{"type":45,"tag":70,"props":102,"children":103},{},[104],{"type":51,"value":105},"Connection Lifecycle",{"type":51,"value":107},": Borrow from pool → Execute operation → Return to pool → Prune idle connections exceeding ",{"type":45,"tag":109,"props":110,"children":112},"code",{"className":111},[],[113],{"type":51,"value":114},"maxIdleTimeMS",{"type":51,"value":116},".",{"type":45,"tag":54,"props":118,"children":119},{},[120,125],{"type":45,"tag":70,"props":121,"children":122},{},[123],{"type":51,"value":124},"Synchronous vs. Asynchronous Drivers",{"type":51,"value":126},":",{"type":45,"tag":84,"props":128,"children":129},{},[130,140],{"type":45,"tag":88,"props":131,"children":132},{},[133,138],{"type":45,"tag":70,"props":134,"children":135},{},[136],{"type":51,"value":137},"Synchronous",{"type":51,"value":139}," (PyMongo, Java sync): Thread blocks; pool size often matches thread pool size",{"type":45,"tag":88,"props":141,"children":142},{},[143,148],{"type":45,"tag":70,"props":144,"children":145},{},[146],{"type":51,"value":147},"Asynchronous",{"type":51,"value":149}," (Node.js, Motor): Non-blocking I\u002FO; smaller pools suffice",{"type":45,"tag":54,"props":151,"children":152},{},[153,158,160,166],{"type":45,"tag":70,"props":154,"children":155},{},[156],{"type":51,"value":157},"Monitoring Connections",{"type":51,"value":159},": Each MongoClient establishes 2 monitoring connections per replica set member (automatic, separate from your pool). Formula: ",{"type":45,"tag":109,"props":161,"children":163},{"className":162},[],[164],{"type":51,"value":165},"Total = (minPoolSize + 2) × replica members × app instances",{"type":51,"value":167},". Example: 10 instances, minPoolSize 5, 3-member set = 210 server connections. Always account for this when planning capacity.",{"type":45,"tag":60,"props":169,"children":171},{"id":170},"configuration-design",[172],{"type":51,"value":173},"Configuration Design",{"type":45,"tag":54,"props":175,"children":176},{},[177,182,184,189,191,196],{"type":45,"tag":70,"props":178,"children":179},{},[180],{"type":51,"value":181},"Before suggesting any configuration changes",{"type":51,"value":183},", ensure you have the sufficient context about the user's application environment to inform pool configuration (see ",{"type":45,"tag":70,"props":185,"children":186},{},[187],{"type":51,"value":188},"Environmental Context",{"type":51,"value":190}," below). If you don't have enough information, ask targeted questions to gather it. Ask ",{"type":45,"tag":70,"props":192,"children":193},{},[194],{"type":51,"value":195},"only one question at a time",{"type":51,"value":197},", starting with broad context (deployment type, workload, concurrency) before drilling down into specifics.",{"type":45,"tag":54,"props":199,"children":200},{},[201],{"type":51,"value":202},"When you suggest configuration, briefly explain WHY each parameter has its specific value based on the context you gathered. Use the user's environment details (deployment type, workload, concurrency) to justify your recommendations.",{"type":45,"tag":54,"props":204,"children":205},{},[206,208,214],{"type":51,"value":207},"Example: ",{"type":45,"tag":109,"props":209,"children":211},{"className":210},[],[212],{"type":51,"value":213},"maxPoolSize: 50",{"type":51,"value":215}," — \"Based on your observed peak of 40 concurrent operations with 25% headroom for traffic bursts\"",{"type":45,"tag":54,"props":217,"children":218},{},[219],{"type":51,"value":220},"If you provide code snippets, add inline comments explaining the rationale for each parameter choice.",{"type":45,"tag":222,"props":223,"children":225},"h3",{"id":224},"calculating-initial-pool-size",[226],{"type":51,"value":227},"Calculating Initial Pool Size",{"type":45,"tag":54,"props":229,"children":230},{},[231,233],{"type":51,"value":232},"If performance data available: ",{"type":45,"tag":109,"props":234,"children":236},{"className":235},[],[237],{"type":51,"value":238},"Pool Size ≈ (Ops\u002Fsec) × (Avg duration) + 10-20% buffer",{"type":45,"tag":54,"props":240,"children":241},{},[242,243],{"type":51,"value":207},{"type":45,"tag":109,"props":244,"children":246},{"className":245},[],[247],{"type":51,"value":248},"(10,000 ops\u002Fsec) × (10ms) + 20% buffer = 120 connections",{"type":45,"tag":54,"props":250,"children":251},{},[252],{"type":51,"value":253},"Use when: Clear requirements, known latency, predictable traffic.\nDon't use when: variable durations—start conservative (10-20), monitor, adjust.",{"type":45,"tag":54,"props":255,"children":256},{},[257],{"type":51,"value":258},"Query optimization can dramatically reduce required pool size.",{"type":45,"tag":54,"props":260,"children":261},{},[262,264,270],{"type":51,"value":263},"The total number of supported connections in a cluster could inform the upper limit of poolSize based on the number of MongoClient's instances employed. For example, if you have 10 instances of MongoClient using a size of 5 connecting to a 3 node replica set: ",{"type":45,"tag":109,"props":265,"children":267},{"className":266},[],[268],{"type":51,"value":269},"10 instances × 5 connections × 3 servers = 150 connections",{"type":51,"value":116},{"type":45,"tag":54,"props":272,"children":273},{},[274],{"type":51,"value":275},"Each connection requires ~1 MB of physical RAM, so you may find that the optimal value for this parameter is also informed by the resource footprint of your application's workload.",{"type":45,"tag":277,"props":278,"children":280},"h4",{"id":279},"the-role-of-topology",[281],{"type":51,"value":282},"The role of Topology:",{"type":45,"tag":84,"props":284,"children":285},{},[286,291,296,301,306],{"type":45,"tag":88,"props":287,"children":288},{},[289],{"type":51,"value":290},"Pools are created per server per MongoClient.",{"type":45,"tag":88,"props":292,"children":293},{},[294],{"type":51,"value":295},"By default, clients connect to one mongos router per sharded cluster (which manages connections to the shards internally), not to individual shards; so the shard amount do not affect the pool size directly.",{"type":45,"tag":88,"props":297,"children":298},{},[299],{"type":51,"value":300},"Shards share the workload and reduce stress on each individual server, increasing cluster capacity.",{"type":45,"tag":88,"props":302,"children":303},{},[304],{"type":51,"value":305},"Replica members do not affect the max pool directly. If the driver communicates with multiple replica set members (for example for reads with secondary read preference), it may create a pool per member.",{"type":45,"tag":88,"props":307,"children":308},{},[309],{"type":51,"value":310},"Replica set members do not increase write capacity (only the primary handles writes). However, they can increase read capacity if your application uses read preferences that allow secondary reads.",{"type":45,"tag":277,"props":312,"children":314},{"id":313},"server-side-connection-limits",[315],{"type":51,"value":316},"Server-Side Connection Limits:",{"type":45,"tag":54,"props":318,"children":319},{},[320,322,328,330,336],{"type":51,"value":321},"Total potential connections = instances × (maxPoolSize + 2) × replica set members. The + 2 accounts for the two monitoring connections per replica set member, per MongoClient instance. Monitor ",{"type":45,"tag":109,"props":323,"children":325},{"className":324},[],[326],{"type":51,"value":327},"connections.current",{"type":51,"value":329}," to avoid hitting limits. See ",{"type":45,"tag":109,"props":331,"children":333},{"className":332},[],[334],{"type":51,"value":335},"references\u002Fmonitoring-guide.md",{"type":51,"value":337}," for how to set up monitoring.",{"type":45,"tag":54,"props":339,"children":340},{},[341,346,348,354],{"type":45,"tag":70,"props":342,"children":343},{},[344],{"type":51,"value":345},"Self-managed Servers",{"type":51,"value":347},": Set ",{"type":45,"tag":109,"props":349,"children":351},{"className":350},[],[352],{"type":51,"value":353},"net.maxIncomingConnections",{"type":51,"value":355}," to a value slightly higher than the maximum number of connections that the client creates, or the maximum size of the connection pool. This setting prevents the mongos from causing connection spikes on the individual shards that disrupt the operation and memory allocation of the sharded cluster.",{"type":45,"tag":222,"props":357,"children":359},{"id":358},"configuration-scenarios",[360],{"type":51,"value":361},"Configuration Scenarios",{"type":45,"tag":54,"props":363,"children":364},{},[365],{"type":45,"tag":70,"props":366,"children":367},{},[368],{"type":51,"value":369},"General best practices:",{"type":45,"tag":84,"props":371,"children":372},{},[373,378,383,388,393],{"type":45,"tag":88,"props":374,"children":375},{},[376],{"type":51,"value":377},"Create client once only and reuse across application (in serverless, initialize outside handler)",{"type":45,"tag":88,"props":379,"children":380},{},[381],{"type":51,"value":382},"Don't manually close connections unless shutting down",{"type":45,"tag":88,"props":384,"children":385},{},[386],{"type":51,"value":387},"Max pool size must exceed expected concurrency",{"type":45,"tag":88,"props":389,"children":390},{},[391],{"type":51,"value":392},"Make use of timeouts to keep only the required connections ready as per your workload's needs",{"type":45,"tag":88,"props":394,"children":395},{},[396],{"type":51,"value":397},"Use default max pool size (100) unless you have specific needs (see scenarios below)",{"type":45,"tag":277,"props":399,"children":401},{"id":400},"scenario-serverless-environments-lambda-cloud-functions",[402],{"type":51,"value":403},"Scenario: Serverless Environments (Lambda, Cloud Functions)",{"type":45,"tag":54,"props":405,"children":406},{},[407,412],{"type":45,"tag":70,"props":408,"children":409},{},[410],{"type":51,"value":411},"Critical pattern",{"type":51,"value":413},": Initialize client OUTSIDE handler\u002Ffunction scope to enable connection reuse across warm invocations.",{"type":45,"tag":54,"props":415,"children":416},{},[417,422],{"type":45,"tag":70,"props":418,"children":419},{},[420],{"type":51,"value":421},"Recommended configuration",{"type":51,"value":126},{"type":45,"tag":424,"props":425,"children":426},"table",{},[427,451],{"type":45,"tag":428,"props":429,"children":430},"thead",{},[431],{"type":45,"tag":432,"props":433,"children":434},"tr",{},[435,441,446],{"type":45,"tag":436,"props":437,"children":438},"th",{},[439],{"type":51,"value":440},"Parameter",{"type":45,"tag":436,"props":442,"children":443},{},[444],{"type":51,"value":445},"Value",{"type":45,"tag":436,"props":447,"children":448},{},[449],{"type":51,"value":450},"Reasoning",{"type":45,"tag":452,"props":453,"children":454},"tbody",{},[455,478,500,521,543],{"type":45,"tag":432,"props":456,"children":457},{},[458,468,473],{"type":45,"tag":459,"props":460,"children":461},"td",{},[462],{"type":45,"tag":109,"props":463,"children":465},{"className":464},[],[466],{"type":51,"value":467},"maxPoolSize",{"type":45,"tag":459,"props":469,"children":470},{},[471],{"type":51,"value":472},"3-5",{"type":45,"tag":459,"props":474,"children":475},{},[476],{"type":51,"value":477},"Each serverless function instance has its own pool",{"type":45,"tag":432,"props":479,"children":480},{},[481,490,495],{"type":45,"tag":459,"props":482,"children":483},{},[484],{"type":45,"tag":109,"props":485,"children":487},{"className":486},[],[488],{"type":51,"value":489},"minPoolSize",{"type":45,"tag":459,"props":491,"children":492},{},[493],{"type":51,"value":494},"0",{"type":45,"tag":459,"props":496,"children":497},{},[498],{"type":51,"value":499},"Prevent maintaining unused connections. Increase to mitigate cold starts if needed",{"type":45,"tag":432,"props":501,"children":502},{},[503,511,516],{"type":45,"tag":459,"props":504,"children":505},{},[506],{"type":45,"tag":109,"props":507,"children":509},{"className":508},[],[510],{"type":51,"value":114},{"type":45,"tag":459,"props":512,"children":513},{},[514],{"type":51,"value":515},"10-30s",{"type":45,"tag":459,"props":517,"children":518},{},[519],{"type":51,"value":520},"Release unused connections more quickly",{"type":45,"tag":432,"props":522,"children":523},{},[524,533,538],{"type":45,"tag":459,"props":525,"children":526},{},[527],{"type":45,"tag":109,"props":528,"children":530},{"className":529},[],[531],{"type":51,"value":532},"connectTimeoutMS",{"type":45,"tag":459,"props":534,"children":535},{},[536],{"type":51,"value":537},">0",{"type":45,"tag":459,"props":539,"children":540},{},[541],{"type":51,"value":542},"Set to a value greater than the longest network latency you have to a member of the set",{"type":45,"tag":432,"props":544,"children":545},{},[546,555,559],{"type":45,"tag":459,"props":547,"children":548},{},[549],{"type":45,"tag":109,"props":550,"children":552},{"className":551},[],[553],{"type":51,"value":554},"socketTimeoutMS",{"type":45,"tag":459,"props":556,"children":557},{},[558],{"type":51,"value":537},{"type":45,"tag":459,"props":560,"children":561},{},[562],{"type":51,"value":563},"Use socketTimeoutMS to ensure that sockets are always closed",{"type":45,"tag":565,"props":566,"children":568},"h5",{"id":567},"scenario-traditional-long-running-servers-oltp-workload",[569],{"type":51,"value":570},"Scenario: Traditional Long-Running Servers (OLTP Workload)",{"type":45,"tag":54,"props":572,"children":573},{},[574,578],{"type":45,"tag":70,"props":575,"children":576},{},[577],{"type":51,"value":421},{"type":51,"value":126},{"type":45,"tag":424,"props":580,"children":581},{},[582,600],{"type":45,"tag":428,"props":583,"children":584},{},[585],{"type":45,"tag":432,"props":586,"children":587},{},[588,592,596],{"type":45,"tag":436,"props":589,"children":590},{},[591],{"type":51,"value":440},{"type":45,"tag":436,"props":593,"children":594},{},[595],{"type":51,"value":445},{"type":45,"tag":436,"props":597,"children":598},{},[599],{"type":51,"value":450},{"type":45,"tag":452,"props":601,"children":602},{},[603,624,645,666,687,708],{"type":45,"tag":432,"props":604,"children":605},{},[606,614,619],{"type":45,"tag":459,"props":607,"children":608},{},[609],{"type":45,"tag":109,"props":610,"children":612},{"className":611},[],[613],{"type":51,"value":467},{"type":45,"tag":459,"props":615,"children":616},{},[617],{"type":51,"value":618},"50+",{"type":45,"tag":459,"props":620,"children":621},{},[622],{"type":51,"value":623},"Based on peak concurrent requests (monitor and adjust)",{"type":45,"tag":432,"props":625,"children":626},{},[627,635,640],{"type":45,"tag":459,"props":628,"children":629},{},[630],{"type":45,"tag":109,"props":631,"children":633},{"className":632},[],[634],{"type":51,"value":489},{"type":45,"tag":459,"props":636,"children":637},{},[638],{"type":51,"value":639},"10-20",{"type":45,"tag":459,"props":641,"children":642},{},[643],{"type":51,"value":644},"Pre-warmed connections ready for traffic spikes",{"type":45,"tag":432,"props":646,"children":647},{},[648,656,661],{"type":45,"tag":459,"props":649,"children":650},{},[651],{"type":45,"tag":109,"props":652,"children":654},{"className":653},[],[655],{"type":51,"value":114},{"type":45,"tag":459,"props":657,"children":658},{},[659],{"type":51,"value":660},"5-10min",{"type":45,"tag":459,"props":662,"children":663},{},[664],{"type":51,"value":665},"Stable servers benefit from persistent connections",{"type":45,"tag":432,"props":667,"children":668},{},[669,677,682],{"type":45,"tag":459,"props":670,"children":671},{},[672],{"type":45,"tag":109,"props":673,"children":675},{"className":674},[],[676],{"type":51,"value":532},{"type":45,"tag":459,"props":678,"children":679},{},[680],{"type":51,"value":681},"5-10s",{"type":45,"tag":459,"props":683,"children":684},{},[685],{"type":51,"value":686},"Fail fast on connection issues",{"type":45,"tag":432,"props":688,"children":689},{},[690,698,703],{"type":45,"tag":459,"props":691,"children":692},{},[693],{"type":45,"tag":109,"props":694,"children":696},{"className":695},[],[697],{"type":51,"value":554},{"type":45,"tag":459,"props":699,"children":700},{},[701],{"type":51,"value":702},"30s",{"type":45,"tag":459,"props":704,"children":705},{},[706],{"type":51,"value":707},"Prevent hanging queries; appropriate for short OLTP operations",{"type":45,"tag":432,"props":709,"children":710},{},[711,720,725],{"type":45,"tag":459,"props":712,"children":713},{},[714],{"type":45,"tag":109,"props":715,"children":717},{"className":716},[],[718],{"type":51,"value":719},"serverSelectionTimeoutMS",{"type":45,"tag":459,"props":721,"children":722},{},[723],{"type":51,"value":724},"5s",{"type":45,"tag":459,"props":726,"children":727},{},[728],{"type":51,"value":729},"Quick failover for replica set topology changes",{"type":45,"tag":54,"props":731,"children":732},{},[733],{"type":51,"value":734},"MongoDB 8.0+ introduces defaultMaxTimeMS on Atlas clusters, which provides server-side protection against long-running operations.",{"type":45,"tag":565,"props":736,"children":738},{"id":737},"scenario-olap-analytical-workloads",[739],{"type":51,"value":740},"Scenario: OLAP \u002F Analytical Workloads",{"type":45,"tag":54,"props":742,"children":743},{},[744,748],{"type":45,"tag":70,"props":745,"children":746},{},[747],{"type":51,"value":421},{"type":51,"value":126},{"type":45,"tag":424,"props":750,"children":751},{},[752,770],{"type":45,"tag":428,"props":753,"children":754},{},[755],{"type":45,"tag":432,"props":756,"children":757},{},[758,762,766],{"type":45,"tag":436,"props":759,"children":760},{},[761],{"type":51,"value":440},{"type":45,"tag":436,"props":763,"children":764},{},[765],{"type":51,"value":445},{"type":45,"tag":436,"props":767,"children":768},{},[769],{"type":51,"value":450},{"type":45,"tag":452,"props":771,"children":772},{},[773,793,814,834],{"type":45,"tag":432,"props":774,"children":775},{},[776,784,788],{"type":45,"tag":459,"props":777,"children":778},{},[779],{"type":45,"tag":109,"props":780,"children":782},{"className":781},[],[783],{"type":51,"value":467},{"type":45,"tag":459,"props":785,"children":786},{},[787],{"type":51,"value":639},{"type":45,"tag":459,"props":789,"children":790},{},[791],{"type":51,"value":792},"Fewer concurrent operations. Match your expected concurrent analytical operations",{"type":45,"tag":432,"props":794,"children":795},{},[796,804,809],{"type":45,"tag":459,"props":797,"children":798},{},[799],{"type":45,"tag":109,"props":800,"children":802},{"className":801},[],[803],{"type":51,"value":489},{"type":45,"tag":459,"props":805,"children":806},{},[807],{"type":51,"value":808},"0-5",{"type":45,"tag":459,"props":810,"children":811},{},[812],{"type":51,"value":813},"Queries are infrequent; minimal pre-warming needed",{"type":45,"tag":432,"props":815,"children":816},{},[817,825,829],{"type":45,"tag":459,"props":818,"children":819},{},[820],{"type":45,"tag":109,"props":821,"children":823},{"className":822},[],[824],{"type":51,"value":554},{"type":45,"tag":459,"props":826,"children":827},{},[828],{"type":51,"value":537},{"type":45,"tag":459,"props":830,"children":831},{},[832],{"type":51,"value":833},"Set socketTimeoutMS to two or three times the length of the slowest operation that the driver runs.",{"type":45,"tag":432,"props":835,"children":836},{},[837,845,850],{"type":45,"tag":459,"props":838,"children":839},{},[840],{"type":45,"tag":109,"props":841,"children":843},{"className":842},[],[844],{"type":51,"value":114},{"type":45,"tag":459,"props":846,"children":847},{},[848],{"type":51,"value":849},"10min",{"type":45,"tag":459,"props":851,"children":852},{},[853],{"type":51,"value":854},"Minimize connection churn while not keeping truly idle connections too long. Consider the timeouts of intermediate network devices",{"type":45,"tag":565,"props":856,"children":858},{"id":857},"scenario-high-traffic-bursty-workloads",[859],{"type":51,"value":860},"Scenario: High-Traffic \u002F Bursty Workloads",{"type":45,"tag":54,"props":862,"children":863},{},[864,868],{"type":45,"tag":70,"props":865,"children":866},{},[867],{"type":51,"value":421},{"type":51,"value":126},{"type":45,"tag":424,"props":870,"children":871},{},[872,890],{"type":45,"tag":428,"props":873,"children":874},{},[875],{"type":45,"tag":432,"props":876,"children":877},{},[878,882,886],{"type":45,"tag":436,"props":879,"children":880},{},[881],{"type":51,"value":440},{"type":45,"tag":436,"props":883,"children":884},{},[885],{"type":51,"value":445},{"type":45,"tag":436,"props":887,"children":888},{},[889],{"type":51,"value":450},{"type":45,"tag":452,"props":891,"children":892},{},[893,914,935,957,979],{"type":45,"tag":432,"props":894,"children":895},{},[896,904,909],{"type":45,"tag":459,"props":897,"children":898},{},[899],{"type":45,"tag":109,"props":900,"children":902},{"className":901},[],[903],{"type":51,"value":467},{"type":45,"tag":459,"props":905,"children":906},{},[907],{"type":51,"value":908},"100+",{"type":45,"tag":459,"props":910,"children":911},{},[912],{"type":51,"value":913},"Higher ceiling to accommodate sudden traffic spikes",{"type":45,"tag":432,"props":915,"children":916},{},[917,925,930],{"type":45,"tag":459,"props":918,"children":919},{},[920],{"type":45,"tag":109,"props":921,"children":923},{"className":922},[],[924],{"type":51,"value":489},{"type":45,"tag":459,"props":926,"children":927},{},[928],{"type":51,"value":929},"20-30",{"type":45,"tag":459,"props":931,"children":932},{},[933],{"type":51,"value":934},"More pre-warmed connections ready for immediate bursts",{"type":45,"tag":432,"props":936,"children":937},{},[938,947,952],{"type":45,"tag":459,"props":939,"children":940},{},[941],{"type":45,"tag":109,"props":942,"children":944},{"className":943},[],[945],{"type":51,"value":946},"maxConnecting",{"type":45,"tag":459,"props":948,"children":949},{},[950],{"type":51,"value":951},"2 (default)",{"type":45,"tag":459,"props":953,"children":954},{},[955],{"type":51,"value":956},"Prevent thundering herd during sudden demand",{"type":45,"tag":432,"props":958,"children":959},{},[960,969,974],{"type":45,"tag":459,"props":961,"children":962},{},[963],{"type":45,"tag":109,"props":964,"children":966},{"className":965},[],[967],{"type":51,"value":968},"waitQueueTimeoutMS",{"type":45,"tag":459,"props":970,"children":971},{},[972],{"type":51,"value":973},"2-5s",{"type":45,"tag":459,"props":975,"children":976},{},[977],{"type":51,"value":978},"Fail fast when pool exhausted rather than queueing indefinitely",{"type":45,"tag":432,"props":980,"children":981},{},[982,990,995],{"type":45,"tag":459,"props":983,"children":984},{},[985],{"type":45,"tag":109,"props":986,"children":988},{"className":987},[],[989],{"type":51,"value":114},{"type":45,"tag":459,"props":991,"children":992},{},[993],{"type":51,"value":994},"5min",{"type":45,"tag":459,"props":996,"children":997},{},[998],{"type":51,"value":999},"Balance between reuse during bursts and cleanup between spikes",{"type":45,"tag":60,"props":1001,"children":1003},{"id":1002},"troubleshooting-connection-issues",[1004],{"type":51,"value":1005},"Troubleshooting Connection Issues",{"type":45,"tag":54,"props":1007,"children":1008},{},[1009],{"type":51,"value":1010},"If the user requires help to troubleshoot connection issues, determine whether this is a client config issue or infrastructure problem.",{"type":45,"tag":54,"props":1012,"children":1013},{},[1014],{"type":51,"value":1015},"Types of issues:",{"type":45,"tag":84,"props":1017,"children":1018},{},[1019,1037],{"type":45,"tag":88,"props":1020,"children":1021},{},[1022,1027,1029],{"type":45,"tag":70,"props":1023,"children":1024},{},[1025],{"type":51,"value":1026},"Infrastructure or Network Issues (Out of Scope)",{"type":51,"value":1028},": redirect to publicly available infractructure documentation.\n",{"type":45,"tag":84,"props":1030,"children":1031},{},[1032],{"type":45,"tag":88,"props":1033,"children":1034},{},[1035],{"type":51,"value":1036},"eg: DNS\u002FSRV resolution failures, network\u002FVPC blocking, IP not whitelisted, TLS cert issues, auth mechanism mismatches",{"type":45,"tag":88,"props":1038,"children":1039},{},[1040,1045,1047],{"type":45,"tag":70,"props":1041,"children":1042},{},[1043],{"type":51,"value":1044},"Client Configuration Issues (Your Territory)",{"type":51,"value":1046},":\n",{"type":45,"tag":84,"props":1048,"children":1049},{},[1050],{"type":45,"tag":88,"props":1051,"children":1052},{},[1053],{"type":51,"value":1054},"eg: Pool exhaustion, inappropriate timeouts, poor reuse patterns, suboptimal sizing, missing serverless caching, connection churn",{"type":45,"tag":222,"props":1056,"children":1058},{"id":1057},"guidelines",[1059],{"type":51,"value":1060},"Guidelines",{"type":45,"tag":84,"props":1062,"children":1063},{},[1064,1075],{"type":45,"tag":88,"props":1065,"children":1066},{},[1067,1069,1073],{"type":51,"value":1068},"Ask ",{"type":45,"tag":70,"props":1070,"children":1071},{},[1072],{"type":51,"value":195},{"type":51,"value":1074},", starting with broad context (deployment type, workload, concurrency) before drilling down into specifics (current config, error messages). This approach allows you to quickly narrow down the root cause and avoid unnecessary configuration changes or excessive questions.",{"type":45,"tag":88,"props":1076,"children":1077},{},[1078,1080,1085],{"type":51,"value":1079},"Review ",{"type":45,"tag":109,"props":1081,"children":1083},{"className":1082},[],[1084],{"type":51,"value":335},{"type":51,"value":1086}," for how to instrument and monitor the relevant parameters that can inform your troubleshooting and recommendations.",{"type":45,"tag":222,"props":1088,"children":1090},{"id":1089},"pool-exhaustion",[1091],{"type":51,"value":1092},"Pool Exhaustion",{"type":45,"tag":54,"props":1094,"children":1095},{},[1096],{"type":51,"value":1097},"When operations queue, pool is exhausted.",{"type":45,"tag":54,"props":1099,"children":1100},{},[1101,1106,1108,1114,1116,1122,1124,1130],{"type":45,"tag":70,"props":1102,"children":1103},{},[1104],{"type":51,"value":1105},"Symptoms",{"type":51,"value":1107},": ",{"type":45,"tag":109,"props":1109,"children":1111},{"className":1110},[],[1112],{"type":51,"value":1113},"MongoWaitQueueTimeoutError",{"type":51,"value":1115},", ",{"type":45,"tag":109,"props":1117,"children":1119},{"className":1118},[],[1120],{"type":51,"value":1121},"WaitQueueTimeoutError",{"type":51,"value":1123}," or ",{"type":45,"tag":109,"props":1125,"children":1127},{"className":1126},[],[1128],{"type":51,"value":1129},"MongoTimeoutException",{"type":51,"value":1131},", increased latency, operations waiting.",{"type":45,"tag":54,"props":1133,"children":1134},{},[1135,1140],{"type":45,"tag":70,"props":1136,"children":1137},{},[1138],{"type":51,"value":1139},"Solutions",{"type":51,"value":126},{"type":45,"tag":84,"props":1142,"children":1143},{},[1144,1159],{"type":45,"tag":88,"props":1145,"children":1146},{},[1147,1157],{"type":45,"tag":70,"props":1148,"children":1149},{},[1150,1152],{"type":51,"value":1151},"Increase ",{"type":45,"tag":109,"props":1153,"children":1155},{"className":1154},[],[1156],{"type":51,"value":467},{"type":51,"value":1158}," when: Wait queue has operations waiting (size > 0) + server shows low utilization",{"type":45,"tag":88,"props":1160,"children":1161},{},[1162,1167],{"type":45,"tag":70,"props":1163,"children":1164},{},[1165],{"type":51,"value":1166},"Don't increase",{"type":51,"value":1168}," when: Server is at capacity. Suggest query optimization.",{"type":45,"tag":222,"props":1170,"children":1172},{"id":1171},"connection-timeouts-econnrefused-sockettimeout",[1173],{"type":51,"value":1174},"Connection Timeouts (ECONNREFUSED, SocketTimeout)",{"type":45,"tag":54,"props":1176,"children":1177},{},[1178,1183,1185,1190,1192,1197],{"type":45,"tag":70,"props":1179,"children":1180},{},[1181],{"type":51,"value":1182},"Client Solutions",{"type":51,"value":1184},": Increase ",{"type":45,"tag":109,"props":1186,"children":1188},{"className":1187},[],[1189],{"type":51,"value":532},{"type":51,"value":1191},"\u002F",{"type":45,"tag":109,"props":1193,"children":1195},{"className":1194},[],[1196],{"type":51,"value":554},{"type":51,"value":1198}," if legitimately needed",{"type":45,"tag":54,"props":1200,"children":1201},{},[1202,1207],{"type":45,"tag":70,"props":1203,"children":1204},{},[1205],{"type":51,"value":1206},"Infrastructure Issues",{"type":51,"value":1208}," (redirect):",{"type":45,"tag":84,"props":1210,"children":1211},{},[1212,1217,1222],{"type":45,"tag":88,"props":1213,"children":1214},{},[1215],{"type":51,"value":1216},"Cannot connect via shell: Network\u002Ffirewall;",{"type":45,"tag":88,"props":1218,"children":1219},{},[1220],{"type":51,"value":1221},"Environment-specific: VPC\u002Fsecurity;",{"type":45,"tag":88,"props":1223,"children":1224},{},[1225],{"type":51,"value":1226},"DNS errors: DNS\u002FSRV resolution",{"type":45,"tag":222,"props":1228,"children":1230},{"id":1229},"connection-churn",[1231],{"type":51,"value":1232},"Connection Churn",{"type":45,"tag":54,"props":1234,"children":1235},{},[1236,1240,1242,1248],{"type":45,"tag":70,"props":1237,"children":1238},{},[1239],{"type":51,"value":1105},{"type":51,"value":1241},": Rapidly increasing ",{"type":45,"tag":109,"props":1243,"children":1245},{"className":1244},[],[1246],{"type":51,"value":1247},"connections.totalCreated",{"type":51,"value":1249}," server metric, high connection handling CPU",{"type":45,"tag":54,"props":1251,"children":1252},{},[1253,1258,1260,1265],{"type":45,"tag":70,"props":1254,"children":1255},{},[1256],{"type":51,"value":1257},"Causes",{"type":51,"value":1259},": Not using pooling, not caching in serverless, ",{"type":45,"tag":109,"props":1261,"children":1263},{"className":1262},[],[1264],{"type":51,"value":114},{"type":51,"value":1266}," too low, restart loops",{"type":45,"tag":222,"props":1268,"children":1270},{"id":1269},"high-latency",[1271],{"type":51,"value":1272},"High Latency",{"type":45,"tag":84,"props":1274,"children":1275},{},[1276,1288,1299],{"type":45,"tag":88,"props":1277,"children":1278},{},[1279,1281,1286],{"type":51,"value":1280},"Ensure ",{"type":45,"tag":109,"props":1282,"children":1284},{"className":1283},[],[1285],{"type":51,"value":489},{"type":51,"value":1287}," > 0 for traffic spikes",{"type":45,"tag":88,"props":1289,"children":1290},{},[1291,1293],{"type":51,"value":1292},"Network compression for high-latency (>50ms): ",{"type":45,"tag":109,"props":1294,"children":1296},{"className":1295},[],[1297],{"type":51,"value":1298},"compressors: ['snappy', 'zlib']",{"type":45,"tag":88,"props":1300,"children":1301},{},[1302],{"type":51,"value":1303},"Nearest read preference for geo-distributed setups",{"type":45,"tag":1305,"props":1306,"children":1307},"hr",{},[],{"type":45,"tag":60,"props":1309,"children":1311},{"id":1310},"environmental-context-mandatory",[1312],{"type":51,"value":1313},"Environmental Context (MANDATORY)",{"type":45,"tag":54,"props":1315,"children":1316},{},[1317,1322],{"type":45,"tag":70,"props":1318,"children":1319},{},[1320],{"type":51,"value":1321},"ALWAYS",{"type":51,"value":1323}," verify you have the sufficient context about the user's application environment to inform pool configuration BEFORE suggesting any configuration changes.",{"type":45,"tag":222,"props":1325,"children":1327},{"id":1326},"parameters-that-inform-a-pool-configuration",[1328],{"type":51,"value":1329},"Parameters that inform a pool configuration",{"type":45,"tag":84,"props":1331,"children":1332},{},[1333,1343,1353,1371,1381,1391,1401,1411],{"type":45,"tag":88,"props":1334,"children":1335},{},[1336,1341],{"type":45,"tag":70,"props":1337,"children":1338},{},[1339],{"type":51,"value":1340},"Server's memory limits",{"type":51,"value":1342},": each connection takes 1MB against the server.",{"type":45,"tag":88,"props":1344,"children":1345},{},[1346,1351],{"type":45,"tag":70,"props":1347,"children":1348},{},[1349],{"type":51,"value":1350},"Number of clients and servers in a cluster",{"type":51,"value":1352},": pools are per client and per server, taking memory from the cluster.",{"type":45,"tag":88,"props":1354,"children":1355},{},[1356,1361,1363],{"type":45,"tag":70,"props":1357,"children":1358},{},[1359],{"type":51,"value":1360},"OLAP vs OLTP",{"type":51,"value":1362},": timeout values must support the expected duration of operations.\n",{"type":45,"tag":84,"props":1364,"children":1365},{},[1366],{"type":45,"tag":88,"props":1367,"children":1368},{},[1369],{"type":51,"value":1370},"Expected duration of operations: Short OLTP queries may require lower socketTimeoutMS to fail fast on hanging operations, while long-running OLAP queries may need higher values to avoid premature timeouts.",{"type":45,"tag":88,"props":1372,"children":1373},{},[1374,1379],{"type":45,"tag":70,"props":1375,"children":1376},{},[1377],{"type":51,"value":1378},"Server version",{"type":51,"value":1380},": MongoDB 8.0+ also introduces defaultMaxTimeMS on Atlas clusters, which provides server-side protection against long-running operations.",{"type":45,"tag":88,"props":1382,"children":1383},{},[1384,1389],{"type":45,"tag":70,"props":1385,"children":1386},{},[1387],{"type":51,"value":1388},"Serverless vs Traditional",{"type":51,"value":1390},": Serverless functions should initialize clients outside the handler to enable connection reuse across warm invocations, while traditional servers can maintain larger pools with pre-warmed connections.",{"type":45,"tag":88,"props":1392,"children":1393},{},[1394,1399],{"type":45,"tag":70,"props":1395,"children":1396},{},[1397],{"type":51,"value":1398},"Concurrency and traffic patterns",{"type":51,"value":1400},": High concurrency and bursty traffic may require larger pools and more pre-warmed connections, while steady, low-concurrency workloads can often operate efficiently with smaller pools.",{"type":45,"tag":88,"props":1402,"children":1403},{},[1404,1409],{"type":45,"tag":70,"props":1405,"children":1406},{},[1407],{"type":51,"value":1408},"Operating System",{"type":51,"value":1410},": Some OSes have limits on the number of open file descriptors, which can impact the maximum number of connections. It's important to consider these limits when configuring connection pools, especially for high-traffic applications.",{"type":45,"tag":88,"props":1412,"children":1413},{},[1414,1419],{"type":45,"tag":70,"props":1415,"children":1416},{},[1417],{"type":51,"value":1418},"Driver version",{"type":51,"value":1420},": Different driver versions may have different default settings and performance characteristics. Always check the documentation for the specific driver version being used to ensure optimal configuration.",{"type":45,"tag":54,"props":1422,"children":1423},{},[1424],{"type":45,"tag":70,"props":1425,"children":1426},{},[1427],{"type":51,"value":1428},"Guidelines:",{"type":45,"tag":84,"props":1430,"children":1431},{},[1432,1449],{"type":45,"tag":88,"props":1433,"children":1434},{},[1435,1437,1442,1444,1448],{"type":51,"value":1436},"Ask only questions relevant to the scenarios in ",{"type":45,"tag":70,"props":1438,"children":1439},{},[1440],{"type":51,"value":1441},"Configuration Design Phase",{"type":51,"value":1443},". Omit questions that won't lead to a clear use of the content in ",{"type":45,"tag":70,"props":1445,"children":1446},{},[1447],{"type":51,"value":1441},{"type":51,"value":116},{"type":45,"tag":88,"props":1450,"children":1451},{},[1452],{"type":51,"value":1453},"If an answer not provided, make a reasonable assumption and disclose it.",{"type":45,"tag":1305,"props":1455,"children":1456},{},[],{"type":45,"tag":60,"props":1458,"children":1460},{"id":1459},"advising-on-monitoring-iteration",[1461],{"type":51,"value":1462},"Advising on Monitoring & Iteration",{"type":45,"tag":54,"props":1464,"children":1465},{},[1466,1471,1473,1478],{"type":45,"tag":70,"props":1467,"children":1468},{},[1469],{"type":51,"value":1470},"You must guide users to monitor",{"type":51,"value":1472}," the relevant parameters to their pool configuration.\nFor detailed monitoring setup, see ",{"type":45,"tag":109,"props":1474,"children":1476},{"className":1475},[],[1477],{"type":51,"value":335},{"type":51,"value":116},{"type":45,"tag":1305,"props":1480,"children":1481},{},[],{"type":45,"tag":60,"props":1483,"children":1485},{"id":1484},"when-creating-code",[1486],{"type":51,"value":1487},"When creating code",{"type":45,"tag":54,"props":1489,"children":1490},{},[1491],{"type":51,"value":1492},"For every connection parameter you provide (in recommendations or code snippets), ensure you have enough context about the user's application environment to inform values. If not, ask targeted questions before suggesting specific values. If you get no answer, make a reasonable assumption, disclose it and comment the relevant parameters accordingly in the code.",{"items":1494,"total":1619},[1495,1510,1516,1529,1541,1554,1567,1584,1601],{"slug":1496,"name":1496,"fn":1497,"description":1498,"org":1499,"tags":1500,"stars":20,"repoUrl":21,"updatedAt":1509},"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},[1501,1504,1507,1508],{"name":1502,"slug":1503,"type":15},"Data Engineering","data-engineering",{"name":1505,"slug":1506,"type":15},"Data Pipeline","data-pipeline",{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},"2026-07-13T06:15:32.953796",{"slug":4,"name":4,"fn":5,"description":6,"org":1511,"tags":1512,"stars":20,"repoUrl":21,"updatedAt":22},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1513,1514,1515],{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":1517,"name":1517,"fn":1518,"description":1519,"org":1520,"tags":1521,"stars":20,"repoUrl":21,"updatedAt":1528},"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},[1522,1525,1527],{"name":1523,"slug":1524,"type":15},"Configuration","configuration",{"name":1526,"slug":30,"type":15},"MCP",{"name":9,"slug":8,"type":15},"2026-07-16T06:00:24.26424",{"slug":1530,"name":1530,"fn":1531,"description":1532,"org":1533,"tags":1534,"stars":20,"repoUrl":21,"updatedAt":1540},"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},[1535,1538,1539],{"name":1536,"slug":1537,"type":15},"Data Analysis","data-analysis",{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},"2026-07-16T06:02:02.491655",{"slug":1542,"name":1542,"fn":1543,"description":1544,"org":1545,"tags":1546,"stars":20,"repoUrl":21,"updatedAt":1553},"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},[1547,1548,1551,1552],{"name":18,"slug":19,"type":15},{"name":1549,"slug":1550,"type":15},"Debugging","debugging",{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},"2026-07-13T06:15:44.51826",{"slug":1555,"name":1555,"fn":1556,"description":1557,"org":1558,"tags":1559,"stars":20,"repoUrl":21,"updatedAt":1566},"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},[1560,1563,1564,1565],{"name":1561,"slug":1562,"type":15},"Data Modeling","data-modeling",{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},"2026-07-16T06:00:24.782785",{"slug":1568,"name":1568,"fn":1569,"description":1570,"org":1571,"tags":1572,"stars":20,"repoUrl":21,"updatedAt":1583},"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},[1573,1576,1577,1580],{"name":1574,"slug":1575,"type":15},"LLM","llm",{"name":9,"slug":8,"type":15},{"name":1578,"slug":1579,"type":15},"RAG","rag",{"name":1581,"slug":1582,"type":15},"Search","search","2026-07-16T06:01:58.645908",{"slug":1585,"name":1585,"fn":1586,"description":1587,"org":1588,"tags":1589,"stars":1598,"repoUrl":1599,"updatedAt":1600},"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},[1590,1591,1594,1597],{"name":1505,"slug":1506,"type":15},{"name":1592,"slug":1593,"type":15},"ETL","etl",{"name":1595,"slug":1596,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},10,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002FASP_example","2026-07-16T06:02:02.15744",{"slug":1602,"name":1602,"fn":1603,"description":1604,"org":1605,"tags":1606,"stars":1616,"repoUrl":1617,"updatedAt":1618},"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},[1607,1610,1613],{"name":1608,"slug":1609,"type":15},"Automation","automation",{"name":1611,"slug":1612,"type":15},"Security","security",{"name":1614,"slug":1615,"type":15},"Workflow Automation","workflow-automation",1,"https:\u002F\u002Fgithub.com\u002Fmongodb\u002Ftines-claude","2026-07-13T06:15:24.618317",9,{"items":1621,"total":1668},[1622,1629,1635,1641,1647,1654,1661],{"slug":1496,"name":1496,"fn":1497,"description":1498,"org":1623,"tags":1624,"stars":20,"repoUrl":21,"updatedAt":1509},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1625,1626,1627,1628],{"name":1502,"slug":1503,"type":15},{"name":1505,"slug":1506,"type":15},{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"slug":4,"name":4,"fn":5,"description":6,"org":1630,"tags":1631,"stars":20,"repoUrl":21,"updatedAt":22},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1632,1633,1634],{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":1517,"name":1517,"fn":1518,"description":1519,"org":1636,"tags":1637,"stars":20,"repoUrl":21,"updatedAt":1528},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1638,1639,1640],{"name":1523,"slug":1524,"type":15},{"name":1526,"slug":30,"type":15},{"name":9,"slug":8,"type":15},{"slug":1530,"name":1530,"fn":1531,"description":1532,"org":1642,"tags":1643,"stars":20,"repoUrl":21,"updatedAt":1540},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1644,1645,1646],{"name":1536,"slug":1537,"type":15},{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"slug":1542,"name":1542,"fn":1543,"description":1544,"org":1648,"tags":1649,"stars":20,"repoUrl":21,"updatedAt":1553},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1650,1651,1652,1653],{"name":18,"slug":19,"type":15},{"name":1549,"slug":1550,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":1555,"name":1555,"fn":1556,"description":1557,"org":1655,"tags":1656,"stars":20,"repoUrl":21,"updatedAt":1566},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1657,1658,1659,1660],{"name":1561,"slug":1562,"type":15},{"name":18,"slug":19,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"slug":1568,"name":1568,"fn":1569,"description":1570,"org":1662,"tags":1663,"stars":20,"repoUrl":21,"updatedAt":1583},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1664,1665,1666,1667],{"name":1574,"slug":1575,"type":15},{"name":9,"slug":8,"type":15},{"name":1578,"slug":1579,"type":15},{"name":1581,"slug":1582,"type":15},7]