<!-- llms-explorer concept facts · https://llms-explorer.com/tree/server-selection-timeout/ · pack 2026-10-15 · ~934 tokens -->

# Server Selection Timeout

> Depth-first rabbithole dossier for Server Selection Timeout; source-anchored research pack.

Parent: [Client Side Operations Timeout (CSOT)](https://llms-explorer.com/tree/client-side-operations-timeout-csot/) · 4 facets · 7 facts · page: https://llms-explorer.com/tree/server-selection-timeout/

## How it works

- [low] When serverSelectionTryOnce is true, server selection timeouts have no effect; instead, a single immediate topology check is performed if the topology is stale or the first selection attempt fails. Sources: https://raw.githubusercontent.com/mongodb/specifications/master/source/server-selection/server-selection.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/server-selection-timeout-b2b4f4fc30/rabbithole-synthesis.md#core`
- [low] When serverSelectionTryOnce is false, the server selection process loops until a server is successfully selected or until the serverSelectionTimeoutMS is exceeded. Sources: https://raw.githubusercontent.com/mongodb/specifications/master/source/server-selection/server-selection.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/server-selection-timeout-b2b4f4fc30/rabbithole-synthesis.md#core`

## Problems, failure modes and limitations

- [high] The MongoDB driver retries finding a server for serverSelectionTimeoutMS milliseconds, and after each iteration, it returns a server selection timeout error if the context expired or the process exceeded the timeout setting. Sources: https://www.mongodb.com/docs/drivers/go/current/context.md, https://mongoosejs.com/docs/connections.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/server-selection-timeout-b2b4f4fc30/rabbithole-synthesis.md#core`
- [low] If the MongoDB driver cannot find a server to send an operation to after serverSelectionTimeoutMS, it raises a MongoTimeoutError indicating the server selection timed out after 30000 ms. Sources: https://mongoosejs.com/docs/connections.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/server-selection-timeout-b2b4f4fc30/rabbithole-synthesis.md#troubleshooting`

## Comparisons and alternatives

- [low] In a full network outage scenario, setting all timeouts to 1000ms may not prevent a 30-second delay because the error is caused by a DNS operation timeout rather than the server selection timeout. Sources: https://jira.mongodb.org/browse/PYTHON-1902 — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/server-selection-timeout-b2b4f4fc30/rabbithole-synthesis.md#troubleshooting`

## Facts and statements

- [high] The serverSelectionTimeoutMS setting defines the maximum time to block for server selection before throwing an exception, with a default value of 30,000 milliseconds (30 seconds). Sources: https://raw.githubusercontent.com/mongodb/specifications/master/source/server-selection/server-selection.md, https://mongoosejs.com/docs/connections.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/server-selection-timeout-b2b4f4fc30/rabbithole-synthesis.md#core`
- [low] The default serverSelectionTimeoutMS value of 30 seconds was chosen to be sufficient for a typical server primary election to complete, though it may be revised downward as election speeds improve. Sources: https://raw.githubusercontent.com/mongodb/specifications/master/source/server-selection/server-selection.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/server-selection-timeout-b2b4f4fc30/rabbithole-synthesis.md#core`

## Related concepts

- Server — is a part of Server Selection Timeout
- Selection — is a part of Server Selection Timeout
- Timeout — is a part of Server Selection Timeout
