MongoOperationTimeoutError
Node.jsMongoDriverErrortimeoutperformance
The client-side operation timeout (timeoutMS) was exceeded before the operation completed
What is happening?
MongoOperationTimeoutError is part of the Client-Side Operation Timeout (CSOT) feature introduced in the Node.js driver 6.x. When timeoutMS is set, the driver enforces a total timeout for the entire operation including server selection, connection checkout, and server-side execution. This is different from maxTimeMS which only limits server-side execution time.
Common causes
- timeoutMS set too low for the operation
- Slow server selection due to topology issues
- Connection pool exhausted — waiting for available connection
- Slow query or aggregation pipeline on the server
- Server under heavy load