MongoTimeoutException

JavaMongoExceptionconnectivitytimeout

The driver timed out waiting for a suitable server or for the operation to complete

What is happening?

MongoTimeoutException in the Java driver indicates the driver could not find a suitable server or complete the operation within the configured timeout. With CSOT (Client-Side Operation Timeout) in driver 5.x+, this replaces the older MongoSocketReadTimeoutException for many scenarios.

Common causes

  1. serverSelectionTimeoutMS exceeded — no suitable server found
  2. All servers unreachable
  3. Read preference cannot be satisfied
  4. Connection pool exhausted
  5. Server under heavy load

Diagnostic Steps

Related Jira Issues