diff --git a/driver-core/src/main/com/mongodb/ClientSessionOptions.java b/driver-core/src/main/com/mongodb/ClientSessionOptions.java index 4f23caacda8..3c92234030a 100644 --- a/driver-core/src/main/com/mongodb/ClientSessionOptions.java +++ b/driver-core/src/main/com/mongodb/ClientSessionOptions.java @@ -93,9 +93,9 @@ public TransactionOptions getDefaultTransactionOptions() { *
Note: When using synchronous API, this timeout does not limit socket writes, therefore - * there is a possibility that the operation might not be timed out when expected. This limitation does not - * apply to the reactive streams API. + *
Note: When using synchronous API, this timeout does not limit socket writes, therefore + * there is a possibility that the operation might not be timed out when expected. This limitation does not + * apply to the reactive streams API. * * @param timeUnit the time unit * @return the default timeout @@ -226,9 +226,9 @@ public Builder defaultTransactionOptions(final TransactionOptions defaultTransac *
Note: When using synchronous API, this timeout does not limit socket writes, therefore - * there is a possibility that the operation might not be timed out when expected. This limitation does not - * apply to the reactive streams API. + *
Note: When using synchronous API, this timeout does not limit socket writes, therefore + * there is a possibility that the operation might not be timed out when expected. This limitation does not + * apply to the reactive streams API. * * @param defaultTimeout the timeout * @param timeUnit the time unit diff --git a/driver-core/src/main/com/mongodb/MongoClientSettings.java b/driver-core/src/main/com/mongodb/MongoClientSettings.java index 8f462df193e..cb7df3946e4 100644 --- a/driver-core/src/main/com/mongodb/MongoClientSettings.java +++ b/driver-core/src/main/com/mongodb/MongoClientSettings.java @@ -432,9 +432,13 @@ public Builder writeConcern(final WriteConcern writeConcern) { * *
Starting with the 3.11.0 release, the default value is true
* + *If a {@linkplain #timeout(long, TimeUnit) timeout} is set, the driver may retry + * multiple times until the timeout expires. Otherwise, at most one retry attempt is made. + * * @param retryWrites sets if writes should be retried if they fail due to a network error. * @return this * @see #getRetryWrites() + * @see #timeout(long, TimeUnit) * @mongodb.server.release 3.6 */ public Builder retryWrites(final boolean retryWrites) { @@ -445,9 +449,13 @@ public Builder retryWrites(final boolean retryWrites) { /** * Sets whether reads should be retried if they fail due to a network error. * + *
If a {@linkplain #timeout(long, TimeUnit) timeout} is set, the driver may retry + * multiple times until the timeout expires. Otherwise, at most one retry attempt is made. + * * @param retryReads sets if reads should be retried if they fail due to a network error. * @return this * @see #getRetryReads() + * @see #timeout(long, TimeUnit) * @since 3.11 * @mongodb.server.release 3.6 */ @@ -716,14 +724,28 @@ public Builder inetAddressResolver(@Nullable final InetAddressResolver inetAddre *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the - * operation might not be timed out when expected. This limitation does not apply to the reactive streams API. + *
The timeout can be set at the following levels (ordered by lowest precedence): + *
If {@linkplain #retryWrites(boolean) write} or {@linkplain #retryReads(boolean) read} retries are enabled, + * the driver may retry multiple times until the timeout expires. + * + *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the + * operation might not be timed out when expected. This limitation does not apply to the reactive streams API. * * @param timeout the timeout * @param timeUnit the time unit * @return this * @since 5.2 - * @see #getTimeout + * @see #getTimeout(TimeUnit) */ @Alpha(Reason.CLIENT) public Builder timeout(final long timeout, final TimeUnit timeUnit) { @@ -792,7 +814,11 @@ public WriteConcern getWriteConcern() { * *
Starting with the 3.11.0 release, the default value is true
* + *If a {@linkplain #getTimeout(TimeUnit) timeout} is set, the driver may retry + * multiple times until the timeout expires. Otherwise, at most one retry attempt is made. + * * @return the retryWrites value + * @see #getTimeout(TimeUnit) * @mongodb.server.release 3.6 */ public boolean getRetryWrites() { @@ -802,7 +828,11 @@ public boolean getRetryWrites() { /** * Returns true if reads should be retried if they fail due to a network error or other retryable error. The default value is true. * + *
If a {@linkplain #getTimeout(TimeUnit) timeout} is set, the driver may retry + * multiple times until the timeout expires. Otherwise, at most one retry attempt is made. + * * @return the retryReads value + * @see #getTimeout(TimeUnit) * @since 3.11 * @mongodb.server.release 3.6 */ @@ -934,12 +964,26 @@ public ServerApi getServerApi() { *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the - * operation might not be timed out when expected. This limitation does not apply to the reactive streams API. + *
The timeout can also be set at the following levels (ordered by lowest precedence): + *
If {@linkplain #getRetryWrites() write} or {@linkplain #getRetryReads() read} retries are enabled, + * the driver may retry multiple times until the timeout expires. Otherwise, at most one retry attempt is made. + * + *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the + * operation might not be timed out when expected. This limitation does not apply to the reactive streams API. * * @param timeUnit the time unit * @return the timeout in the given time unit * @since 5.2 + * @see Builder#timeout(long, TimeUnit) */ @Alpha(Reason.CLIENT) @Nullable diff --git a/driver-core/src/main/com/mongodb/TransactionOptions.java b/driver-core/src/main/com/mongodb/TransactionOptions.java index ed3c88ece60..aae3e59df38 100644 --- a/driver-core/src/main/com/mongodb/TransactionOptions.java +++ b/driver-core/src/main/com/mongodb/TransactionOptions.java @@ -109,8 +109,8 @@ public Long getMaxCommitTime(final TimeUnit timeUnit) { *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the - * operation might not be timed out when expected. This limitation does not apply to the reactive streams API. + *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the + * operation might not be timed out when expected. This limitation does not apply to the reactive streams API. * * @param timeUnit the time unit * @return the timeout in the given time unit @@ -295,8 +295,8 @@ public Builder maxCommitTime(@Nullable final Long maxCommitTime, final TimeUnit *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the - * operation might not be timed out when expected. This limitation does not apply to the reactive streams API. + *
Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the
+ * operation might not be timed out when expected. This limitation does not apply to the reactive streams API.
*
* @param timeout the timeout
* @param timeUnit the time unit
diff --git a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCluster.kt b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCluster.kt
index cf25ac5e8bf..0928baf8bbc 100644
--- a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCluster.kt
+++ b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCluster.kt
@@ -21,6 +21,7 @@ import com.mongodb.MongoClientSettings
import com.mongodb.MongoException
import com.mongodb.ReadConcern
import com.mongodb.ReadPreference
+import com.mongodb.TransactionOptions
import com.mongodb.WriteConcern
import com.mongodb.annotations.Alpha
import com.mongodb.annotations.Reason
@@ -81,7 +82,21 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - [MongoClientSettings.Builder.timeout]
+ * - [MongoCluster.withTimeout] (current)
+ * - [MongoDatabase.withTimeout]
+ * - [MongoCollection.withTimeout]
+ * - [ClientSessionOptions.Builder.defaultTimeout]
+ * - [TransactionOptions.Builder.timeout]
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If [write][MongoClientSettings.Builder.retryWrites] or [read][MongoClientSettings.Builder.retryReads] retries are
+ * enabled, the driver may retry multiple times until the timeout expires.
+ *
* @return the optional timeout duration
+ * @see [withTimeout]
*/
@Alpha(Reason.CLIENT)
public fun timeout(timeUnit: TimeUnit = TimeUnit.MILLISECONDS): Long? = wrapped.getTimeout(timeUnit)
@@ -134,10 +149,23 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo
* - `0` means an infinite timeout
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - [MongoClientSettings.Builder.timeout]
+ * - [MongoCluster.withTimeout] (current)
+ * - [MongoDatabase.withTimeout]
+ * - [MongoCollection.withTimeout]
+ * - [ClientSessionOptions.Builder.defaultTimeout]
+ * - [TransactionOptions.Builder.timeout]
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If [write][MongoClientSettings.Builder.retryWrites] or [read][MongoClientSettings.Builder.retryReads] retries are
+ * enabled, the driver may retry multiple times until the timeout expires.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @param timeUnit the time unit, defaults to Milliseconds
* @return a new MongoCluster instance with the set time limit for operations
- * @see [MongoDatabase.timeout]
+ * @see [timeout]
* @since 5.2
*/
@Alpha(Reason.CLIENT)
diff --git a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCollection.kt b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCollection.kt
index 5602b5ecd11..3bca32ce63c 100644
--- a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCollection.kt
+++ b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoCollection.kt
@@ -15,9 +15,12 @@
*/
package com.mongodb.kotlin.client.coroutine
+import com.mongodb.ClientSessionOptions
+import com.mongodb.MongoClientSettings
import com.mongodb.MongoNamespace
import com.mongodb.ReadConcern
import com.mongodb.ReadPreference
+import com.mongodb.TransactionOptions
import com.mongodb.WriteConcern
import com.mongodb.annotations.Alpha
import com.mongodb.annotations.Reason
@@ -105,7 +108,21 @@ public class MongoCollection The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -170,6 +186,21 @@ public interface MongoCluster {
* The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @param timeUnit the time unit
* @return a new MongoCluster instance with the set time limit for the full execution of an operation.
diff --git a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCollection.java b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCollection.java
index cc6da9dc554..5d53f3e30cc 100644
--- a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCollection.java
+++ b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCollection.java
@@ -134,9 +134,25 @@ public interface MongoCollection The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -199,6 +215,21 @@ public interface MongoCollection The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @param timeUnit the time unit
* @return a new MongoCollection instance with the set time limit for the full execution of an operation
diff --git a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoDatabase.java b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoDatabase.java
index b479ece08c5..5c731decc25 100644
--- a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoDatabase.java
+++ b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoDatabase.java
@@ -101,9 +101,25 @@ public interface MongoDatabase {
* The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -157,6 +173,21 @@ public interface MongoDatabase {
* The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @param timeUnit the time unit
* @return a new MongoDatabase instance with the set time limit for the full execution of an operation.
diff --git a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/gridfs/GridFSBucket.java b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/gridfs/GridFSBucket.java
index 78a3f5357fc..69e215ad0b5 100644
--- a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/gridfs/GridFSBucket.java
+++ b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/gridfs/GridFSBucket.java
@@ -26,6 +26,7 @@
import com.mongodb.client.gridfs.model.GridFSUploadOptions;
import com.mongodb.lang.Nullable;
import com.mongodb.reactivestreams.client.ClientSession;
+import com.mongodb.reactivestreams.client.MongoDatabase;
import org.bson.BsonValue;
import org.bson.conversions.Bson;
import org.bson.types.ObjectId;
@@ -102,9 +103,13 @@ public interface GridFSBucket {
* If not set, the timeout is inherited from whatever the
+ * {@linkplain MongoDatabase#getTimeout MongoDatabase} was resolved to.
+ *
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 4.x
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -152,6 +157,9 @@ public interface GridFSBucket {
* If not set, the timeout is inherited from whatever the
+ * {@linkplain MongoDatabase#getTimeout MongoDatabase} was resolved to.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @param timeUnit the time unit
* @return a new GridFSBucket instance with the set time limit for the full execution of an operation
diff --git a/driver-scala/src/main/scala/org/mongodb/scala/MongoCluster.scala b/driver-scala/src/main/scala/org/mongodb/scala/MongoCluster.scala
index 9e5a75e2d7b..85e50883acd 100644
--- a/driver-scala/src/main/scala/org/mongodb/scala/MongoCluster.scala
+++ b/driver-scala/src/main/scala/org/mongodb/scala/MongoCluster.scala
@@ -99,7 +99,21 @@ class MongoCluster(private val wrapped: JMongoCluster) {
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - `MongoClientSettings.Builder.timeout`
+ * - [[MongoCluster.withTimeout]] (current)
+ * - [[MongoDatabase.withTimeout]]
+ * - [[MongoCollection.withTimeout]]
+ * - `ClientSessionOptions.Builder.defaultTimeout`
+ * - `TransactionOptions.Builder.timeout`
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If `MongoClientSettings.Builder.retryWrites` or `MongoClientSettings.Builder.retryReads` retries
+ * are enabled, the driver may retry multiple times until the timeout expires.
+ *
* @return the optional timeout duration
+ * @see [[withTimeout]]
*/
@Alpha(Array(Reason.CLIENT))
lazy val timeout: Option[Duration] =
@@ -155,8 +169,22 @@ class MongoCluster(private val wrapped: JMongoCluster) {
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - `MongoClientSettings.Builder.timeout`
+ * - [[MongoCluster.withTimeout]] (current)
+ * - [[MongoDatabase.withTimeout]]
+ * - [[MongoCollection.withTimeout]]
+ * - `ClientSessionOptions.Builder.defaultTimeout`
+ * - `TransactionOptions.Builder.timeout`
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If `MongoClientSettings.Builder.retryWrites` or `MongoClientSettings.Builder.retryReads` retries
+ * are enabled, the driver may retry multiple times until the timeout expires.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @return a new MongoCluster instance with the set time limit for operations
+ * @see [[timeout]]
* @since 5.2
*/
@Alpha(Array(Reason.CLIENT))
diff --git a/driver-scala/src/main/scala/org/mongodb/scala/MongoCollection.scala b/driver-scala/src/main/scala/org/mongodb/scala/MongoCollection.scala
index 48e09aa7921..835e16bd6ae 100644
--- a/driver-scala/src/main/scala/org/mongodb/scala/MongoCollection.scala
+++ b/driver-scala/src/main/scala/org/mongodb/scala/MongoCollection.scala
@@ -101,7 +101,21 @@ case class MongoCollection[TResult](private val wrapped: JMongoCollection[TResul
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - `MongoClientSettings.Builder.timeout`
+ * - [[MongoCluster.withTimeout]]
+ * - [[MongoDatabase.withTimeout]]
+ * - [[MongoCollection.withTimeout]] (current)
+ * - `ClientSessionOptions.Builder.defaultTimeout`
+ * - `TransactionOptions.Builder.timeout`
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If `MongoClientSettings.Builder.retryWrites` or `MongoClientSettings.Builder.retryReads` retries
+ * are enabled, the driver may retry multiple times until the timeout expires.
+ *
* @return the optional timeout duration
+ * @see [[withTimeout]]
* @since 5.2
*/
@Alpha(Array(Reason.CLIENT))
@@ -167,8 +181,22 @@ case class MongoCollection[TResult](private val wrapped: JMongoCollection[TResul
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - `MongoClientSettings.Builder.timeout`
+ * - [[MongoCluster.withTimeout]]
+ * - [[MongoDatabase.withTimeout]]
+ * - [[MongoCollection.withTimeout]] (current)
+ * - `ClientSessionOptions.Builder.defaultTimeout`
+ * - `TransactionOptions.Builder.timeout`
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If `MongoClientSettings.Builder.retryWrites` or `MongoClientSettings.Builder.retryReads` retries
+ * are enabled, the driver may retry multiple times until the timeout expires.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @return a new MongoCollection instance with the set time limit for operations
+ * @see [[timeout]]
* @since 5.2
*/
@Alpha(Array(Reason.CLIENT))
diff --git a/driver-scala/src/main/scala/org/mongodb/scala/MongoDatabase.scala b/driver-scala/src/main/scala/org/mongodb/scala/MongoDatabase.scala
index 54c48574c72..06060ea5b28 100644
--- a/driver-scala/src/main/scala/org/mongodb/scala/MongoDatabase.scala
+++ b/driver-scala/src/main/scala/org/mongodb/scala/MongoDatabase.scala
@@ -87,7 +87,21 @@ case class MongoDatabase(private[scala] val wrapped: JMongoDatabase) {
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - `MongoClientSettings.Builder.timeout`
+ * - [[MongoCluster.withTimeout]]
+ * - [[MongoDatabase.withTimeout]] (current)
+ * - [[MongoCollection.withTimeout]]
+ * - `ClientSessionOptions.Builder.defaultTimeout`
+ * - `TransactionOptions.Builder.timeout`
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If `MongoClientSettings.Builder.retryWrites` or `MongoClientSettings.Builder.retryReads` retries
+ * are enabled, the driver may retry multiple times until the timeout expires.
+ *
* @return the optional timeout duration
+ * @see [[withTimeout]]
* @since 5.2
*/
@Alpha(Array(Reason.CLIENT))
@@ -144,8 +158,22 @@ case class MongoDatabase(private[scala] val wrapped: JMongoDatabase) {
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * - `MongoClientSettings.Builder.timeout`
+ * - [[MongoCluster.withTimeout]]
+ * - [[MongoDatabase.withTimeout]] (current)
+ * - [[MongoCollection.withTimeout]]
+ * - `ClientSessionOptions.Builder.defaultTimeout`
+ * - `TransactionOptions.Builder.timeout`
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ * If `MongoClientSettings.Builder.retryWrites` or `MongoClientSettings.Builder.retryReads` retries
+ * are enabled, the driver may retry multiple times until the timeout expires.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @return a new MongoDatabase instance with the set time limit for operations
+ * @see [[timeout]]
* @since 5.2
*/
@Alpha(Array(Reason.CLIENT))
diff --git a/driver-scala/src/main/scala/org/mongodb/scala/gridfs/GridFSBucket.scala b/driver-scala/src/main/scala/org/mongodb/scala/gridfs/GridFSBucket.scala
index 15849798fe3..951d03b338c 100644
--- a/driver-scala/src/main/scala/org/mongodb/scala/gridfs/GridFSBucket.scala
+++ b/driver-scala/src/main/scala/org/mongodb/scala/gridfs/GridFSBucket.scala
@@ -120,7 +120,11 @@ case class GridFSBucket(private val wrapped: JGridFSBucket) {
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * If not set, the timeout is inherited from whatever the
+ * [[MongoDatabase.timeout MongoDatabase]] was resolved to.
+ *
* @return the optional timeout duration
+ * @see [[withTimeout]]
* @since 5.2
*/
@Alpha(Array(Reason.CLIENT))
@@ -168,8 +172,12 @@ case class GridFSBucket(private val wrapped: JGridFSBucket) {
* - `0` means infinite timeout.
* - `> 0` The time limit to use for the full execution of an operation.
*
+ * If not set, the timeout is inherited from whatever the
+ * [[MongoDatabase.timeout MongoDatabase]] was resolved to.
+ *
* @param timeout the timeout, which must be greater than or equal to 0
* @return a new GridFSBucket instance with the set time limit for operations
+ * @see [[timeout]]
* @since 5.2
*/
@Alpha(Array(Reason.CLIENT))
diff --git a/driver-sync/src/main/com/mongodb/client/MongoCluster.java b/driver-sync/src/main/com/mongodb/client/MongoCluster.java
index 198b0a66280..eefe660cc42 100644
--- a/driver-sync/src/main/com/mongodb/client/MongoCluster.java
+++ b/driver-sync/src/main/com/mongodb/client/MongoCluster.java
@@ -110,12 +110,28 @@ public interface MongoCluster {
* The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* Note: This timeout does not limit socket writes, therefore there is a possibility that the
* operation might not be timed out when expected.
*
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -172,6 +188,21 @@ public interface MongoCluster {
* The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* Note: This timeout does not limit socket writes, therefore there is a possibility that the
* operation might not be timed out when expected.
*
diff --git a/driver-sync/src/main/com/mongodb/client/MongoCollection.java b/driver-sync/src/main/com/mongodb/client/MongoCollection.java
index a63b0f2ffcc..ab0ba08d9ae 100644
--- a/driver-sync/src/main/com/mongodb/client/MongoCollection.java
+++ b/driver-sync/src/main/com/mongodb/client/MongoCollection.java
@@ -138,12 +138,28 @@ public interface MongoCollection Note: This timeout does not limit socket writes, therefore there is a possibility that the
- * operation might not be timed out when expected.
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
+ * Note: This timeout does not limit socket writes, therefore there is a possibility that the
+ * operation might not be timed out when expected.
*
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -207,6 +223,21 @@ public interface MongoCollection The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* Note: This timeout does not limit socket writes, therefore there is a possibility that the
* operation might not be timed out when expected.
*
diff --git a/driver-sync/src/main/com/mongodb/client/MongoDatabase.java b/driver-sync/src/main/com/mongodb/client/MongoDatabase.java
index f21aedd597f..30c7da862e6 100644
--- a/driver-sync/src/main/com/mongodb/client/MongoDatabase.java
+++ b/driver-sync/src/main/com/mongodb/client/MongoDatabase.java
@@ -103,12 +103,28 @@ public interface MongoDatabase {
* Note: This timeout does not limit socket writes, therefore there is a possibility that the
- * operation might not be timed out when expected.
+ * The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
+ * Note: This timeout does not limit socket writes, therefore there is a possibility that the
+ * operation might not be timed out when expected.
*
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -163,6 +179,21 @@ public interface MongoDatabase {
* The timeout can be set at the following levels (ordered by lowest precedence):
+ * If {@linkplain com.mongodb.MongoClientSettings.Builder#retryWrites(boolean) write} or
+ * {@linkplain com.mongodb.MongoClientSettings.Builder#retryReads(boolean) read} retries are enabled,
+ * the driver may retry multiple times until the timeout expires.
+ *
* Note: This timeout does not limit socket writes, therefore there is a possibility that the
* operation might not be timed out when expected.
*
diff --git a/driver-sync/src/main/com/mongodb/client/gridfs/GridFSBucket.java b/driver-sync/src/main/com/mongodb/client/gridfs/GridFSBucket.java
index 14756ef9286..17b6c018c4a 100644
--- a/driver-sync/src/main/com/mongodb/client/gridfs/GridFSBucket.java
+++ b/driver-sync/src/main/com/mongodb/client/gridfs/GridFSBucket.java
@@ -104,12 +104,16 @@ public interface GridFSBucket {
* If not set, the timeout is inherited from whatever the
+ * {@linkplain MongoDatabase#getTimeout MongoDatabase} was resolved to.
+ *
* Note: This timeout does not limit socket writes, therefore there is a possibility that the
* operation might not be timed out when expected.
*
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
+ * @see #withTimeout
*/
@Alpha(Reason.CLIENT)
@Nullable
@@ -158,6 +162,9 @@ public interface GridFSBucket {
* If not set, the timeout is inherited from whatever the
+ * {@linkplain MongoDatabase#getTimeout MongoDatabase} was resolved to.
+ *
* Note: This timeout does not limit socket writes, therefore there is a possibility that the
* operation might not be timed out when expected.
*
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *
+ *
+ * If not set at a given level, the timeout is inherited from the level above.
+ *
+ *