Retryable reads allow MongoDB drivers to automatically retry certain read operations a single time if they encounter certain network or server errors.
- Minimum Driver Version
Official MongoDB drivers compatible with MongoDB Server 4.2 and later support retryable reads.
For more information on official MongoDB drivers, see MongoDB Drivers.
- Minimum Server Version
- Drivers can only retry read operations if connected to MongoDB Server 3.6 or later.
Official MongoDB drivers compatible with MongoDB Server 4.2 and later
enable retryable reads by default. To explicitly disable retryable
retryReads=false in the
connection string for the deployment.
mongosh does not support retryable reads.
MongoDB drivers support retrying the following read operations. The list references a generic description of each method. For specific syntax and usage, defer to the driver documentation for that method.
CRUD API Read Operations
Change Stream Operations
GridFS Operations backed by
GridFS File Download Operations
MongoDB drivers may include retryable support for other operations, such as helper methods or methods that wrap a retryable read operation. Defer to the driver documentation to determine whether a method explicitly supports retryable reads.
Retryable Read Specification: Supported Read Operations
The following operations do not support retryable reads:
MongoDB retryable reads make only one retry attempt. This helps address transient network errors or replica set elections, but not persistent network errors.
The driver performs server selection using the read command's original read preference before retrying the read operation. If the driver cannot select a server for the retry attempt using the original read preference, the driver returns the original error.
The drivers wait
before performing server selection. Retryable reads do not address
instances where no eligible servers exist after waiting