Using maxTime() does not yield the same exception when accessing a MongoDB deployment. It seems that timeouts now throw an error code 96 instead of 50 in recent versions of the MongoDB server.
In the Java driver it makes the driver throw a MongoQueryException instead of a MongoExecutionTimeoutException.
Sample Java code:
MongoDatabase db = (new MongoClient()).getDatabase("foo"); MongoCollection<Document> coll = db.getCollection("bar"); coll.insertOne(new Document()); coll.find(Filters.eq("$where", "sleep(100)")).maxTime(100, TimeUnit.MILLISECONDS).first();
- related to
-
SERVER-32208 Remove retrying of OperationFailed in auto_retry_on_network_error.js
- Backlog