Allow to set default maxTimeMS for all cursors
By default, a cursor has no maxTimeMS.
We want to be able to set the default maxTimeMS so all cursors have it set. The current Java driver does not allow to set that default and each cursor needs it manually specified. I.e. a cursor factory or default options would be great.
Alternatively, it would also be great to have this as an option on the cluster itself.
![](https://secure.gravatar.com/avatar/4f65652e7d97e224af4bff47b948d29c?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
AdminAshni (Admin, MongoDB) commented
Hi, thank you for the feedback. We are in the process of introducing a new client-wide timeout to Java (JAVA-3828 will be released first in alpha in the v5.2 release of the Java Driver, with a later GA) that will allow for a new timeoutMS setting that will govern the amount of time a single operation can execute before control is returned to the user. This timeout will cover all the work done to execute an operation (including server selection, connection checkout, and server-side execution). Please have a look at the epic -- or the spec, if you'd like to dive deeper -- and share your feedback. Thank you!
Epic: https://jira.mongodb.org/browse/JAVA-3828
Spec: https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/client-side-operations-timeout.md -
Jean-Christophe commented
In our case, the same behaviour would also be desirable on the reactive java driver and the python driver.