From 4cadad672452180c89c38275eb137d85d832eea6 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Sun, 12 Apr 2026 11:15:01 -0700 Subject: [PATCH 1/3] Improve CSOT API discoverability and document its effect on retrying - Add timeout hierarchy list to getTimeout/withTimeout Javadoc across all driver modules (sync, reactive-streams, Kotlin sync/coroutine, Scala) to improve discoverability - Document the effect of operation timeout on retrying in retryWrites/retryReads and timeout methods on MongoClientSettings - Add cross-references between paired getter/setter methods via @see tags JAVA-6122 --- .../main/com/mongodb/MongoClientSettings.java | 46 ++++++++++++++++++- .../kotlin/client/coroutine/MongoCluster.kt | 29 +++++++++++- .../client/coroutine/MongoCollection.kt | 29 +++++++++++- .../kotlin/client/coroutine/MongoDatabase.kt | 29 +++++++++++- .../com/mongodb/kotlin/client/MongoCluster.kt | 29 +++++++++++- .../mongodb/kotlin/client/MongoCollection.kt | 29 +++++++++++- .../mongodb/kotlin/client/MongoDatabase.kt | 29 +++++++++++- .../reactivestreams/client/MongoCluster.java | 31 +++++++++++++ .../client/MongoCollection.java | 31 +++++++++++++ .../reactivestreams/client/MongoDatabase.java | 31 +++++++++++++ .../org/mongodb/scala/MongoCluster.scala | 28 +++++++++++ .../org/mongodb/scala/MongoCollection.scala | 28 +++++++++++ .../org/mongodb/scala/MongoDatabase.scala | 28 +++++++++++ .../main/com/mongodb/client/MongoCluster.java | 31 +++++++++++++ .../com/mongodb/client/MongoCollection.java | 31 +++++++++++++ .../com/mongodb/client/MongoDatabase.java | 31 +++++++++++++ 16 files changed, 483 insertions(+), 7 deletions(-) diff --git a/driver-core/src/main/com/mongodb/MongoClientSettings.java b/driver-core/src/main/com/mongodb/MongoClientSettings.java index 41c5f73a1d7..68b9e75fd70 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,11 +724,25 @@ public Builder inetAddressResolver(@Nullable final InetAddressResolver inetAddre *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    If {@linkplain #retryWrites(boolean) write} or {@linkplain #retryReads(boolean) read} retries are enabled, + * the driver may retry multiple times until the timeout expires. + * * @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) { @@ -789,7 +811,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() { @@ -799,7 +825,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 */ @@ -931,9 +961,23 @@ public ServerApi getServerApi() { *

  • {@code > 0} The time limit to use for the full execution of an operation.
  • * * + *

    The timeout can also be set at the following levels (ordered by lowest precedence): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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. + * * @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-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..2c6ecfb81b7 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 @@ -81,7 +81,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] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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 +148,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] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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..c5f92a12f51 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 @@ -105,7 +105,21 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - `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) + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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] * @since 5.2 */ @Alpha(Reason.CLIENT) @@ -179,10 +193,23 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - `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] + * - [MongoDatabase.withTimeout] + * - [MongoCollection.withTimeout] (current) + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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 MongoCollection instance with the set time limit for operations - * @see [MongoCollection.timeout] + * @see [timeout] * @since 5.2 */ @Alpha(Reason.CLIENT) diff --git a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt index 007251bab31..c52ebe691ef 100644 --- a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt +++ b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt @@ -73,7 +73,21 @@ public class MongoDatabase(private 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] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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] * @since 5.2 */ @Alpha(Reason.CLIENT) @@ -127,10 +141,23 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) { * - `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] + * - [MongoDatabase.withTimeout] (current) + * - [MongoCollection.withTimeout] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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 MongoDatabase instance with the set time limit for operations - * @see [MongoDatabase.timeout] + * @see [timeout] * @since 5.2 */ @Alpha(Reason.CLIENT) diff --git a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt index 1961989aaa2..67062074857 100644 --- a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt +++ b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt @@ -78,7 +78,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] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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) @@ -131,10 +145,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] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt index 9521c502460..828f274adce 100644 --- a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt +++ b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt @@ -102,7 +102,21 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - `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) + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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] * @since 5.2 */ @Alpha(Reason.CLIENT) @@ -176,10 +190,23 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - `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] + * - [MongoDatabase.withTimeout] + * - [MongoCollection.withTimeout] (current) + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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 MongoCollection instance with the set time limit for operations - * @see [MongoCollection.timeout] + * @see [timeout] * @since 5.2 */ @Alpha(Reason.CLIENT) diff --git a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt index d59ba628008..aa5643e0070 100644 --- a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt +++ b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt @@ -71,7 +71,21 @@ public class MongoDatabase(private 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] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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] * @since 5.2 */ @Alpha(Reason.CLIENT) @@ -125,10 +139,23 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) { * - `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] + * - [MongoDatabase.withTimeout] (current) + * - [MongoCollection.withTimeout] + * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] + * - [com.mongodb.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 MongoDatabase instance with the set time limit for operations - * @see [MongoDatabase.timeout] + * @see [timeout] * @since 5.2 */ @Alpha(Reason.CLIENT) diff --git a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCluster.java b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCluster.java index 0e2a11d9926..45892c51f42 100644 --- a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCluster.java +++ b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoCluster.java @@ -111,9 +111,25 @@ public interface MongoCluster { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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-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-sync/src/main/com/mongodb/client/MongoCluster.java b/driver-sync/src/main/com/mongodb/client/MongoCluster.java index e86761f8d48..b011c1bf55e 100644 --- a/driver-sync/src/main/com/mongodb/client/MongoCluster.java +++ b/driver-sync/src/main/com/mongodb/client/MongoCluster.java @@ -110,9 +110,25 @@ public interface MongoCluster { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 @@ -169,6 +185,21 @@ public interface MongoCluster { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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-sync/src/main/com/mongodb/client/MongoCollection.java b/driver-sync/src/main/com/mongodb/client/MongoCollection.java index 0d3248b613f..dbec2030ca6 100644 --- a/driver-sync/src/main/com/mongodb/client/MongoCollection.java +++ b/driver-sync/src/main/com/mongodb/client/MongoCollection.java @@ -138,9 +138,25 @@ public interface MongoCollection { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 @@ -204,6 +220,21 @@ public interface MongoCollection { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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-sync/src/main/com/mongodb/client/MongoDatabase.java b/driver-sync/src/main/com/mongodb/client/MongoDatabase.java index 1e84a91005a..a0c0bebc4e6 100644 --- a/driver-sync/src/main/com/mongodb/client/MongoDatabase.java +++ b/driver-sync/src/main/com/mongodb/client/MongoDatabase.java @@ -103,9 +103,25 @@ public interface MongoDatabase { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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 @@ -160,6 +176,21 @@ public interface MongoDatabase { *

  • {@code > 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): + *

    + * If not set at a given level, the timeout is inherited from the level above. + * + *

    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. From 6b0c88b7790e550874b931c9d3b203e0ca0b37eb Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Sun, 12 Apr 2026 12:09:33 -0700 Subject: [PATCH 2/3] Add documentation to GridFSBucket. --- .../reactivestreams/client/gridfs/GridFSBucket.java | 8 ++++++++ .../scala/org/mongodb/scala/gridfs/GridFSBucket.scala | 8 ++++++++ .../src/main/com/mongodb/client/gridfs/GridFSBucket.java | 7 +++++++ 3 files changed, 23 insertions(+) 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 { *

  • {@code > 0} The time limit to use for the full execution of an operation.
  • * * + *

    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 { *

  • {@code > 0} The time limit to use for the full execution of an operation.
  • * * + *

    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/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/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 { *

  • {@code > 0} The time limit to use for the full execution of an operation.
  • * * + *

    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 { *

  • {@code > 0} The time limit to use for the full execution of an operation.
  • * * + *

    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. * From 23ef1367f9149f7071160f69f416b97003a20085 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Sun, 12 Apr 2026 13:34:11 -0700 Subject: [PATCH 3/3] Replace fully-qualified KDoc references with imports in Kotlin timeout docs - Add imports for MongoClientSettings, ClientSessionOptions, and TransactionOptions to use short names in KDoc links instead of fully-qualified com.mongodb.* references - Shorten pre-existing fully-qualified KDoc references for ReadPreference, WriteConcern, and MongoClientSettings.getRetryWrites in MongoCollection and MongoCluster JAVA-6122 --- .../kotlin/client/coroutine/MongoCluster.kt | 9 +++++---- .../kotlin/client/coroutine/MongoCollection.kt | 15 +++++++++------ .../kotlin/client/coroutine/MongoDatabase.kt | 11 +++++++---- .../com/mongodb/kotlin/client/MongoCluster.kt | 15 ++++++++------- .../com/mongodb/kotlin/client/MongoCollection.kt | 15 +++++++++------ .../com/mongodb/kotlin/client/MongoDatabase.kt | 11 +++++++---- 6 files changed, 45 insertions(+), 31 deletions(-) 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 2c6ecfb81b7..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 @@ -86,8 +87,8 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo * - [MongoCluster.withTimeout] (current) * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * @@ -153,8 +154,8 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo * - [MongoCluster.withTimeout] (current) * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * 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 c5f92a12f51..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 @@ -110,8 +113,8 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] (current) - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * @@ -163,7 +166,7 @@ public class MongoCollection(private val wrapped: JMongoCollection) /** * Create a new collection instance with a different read preference. * - * @param newReadPreference the new [com.mongodb.ReadPreference] for the collection + * @param newReadPreference the new [ReadPreference] for the collection * @return a new MongoCollection instance with the different readPreference */ public fun withReadPreference(newReadPreference: ReadPreference): MongoCollection = @@ -182,7 +185,7 @@ public class MongoCollection(private val wrapped: JMongoCollection) /** * Create a new collection instance with a different write concern. * - * @param newWriteConcern the new [com.mongodb.WriteConcern] for the collection + * @param newWriteConcern the new [WriteConcern] for the collection * @return a new MongoCollection instance with the different writeConcern */ public fun withWriteConcern(newWriteConcern: WriteConcern): MongoCollection = @@ -198,8 +201,8 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] (current) - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * diff --git a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt index c52ebe691ef..730f8d6afc2 100644 --- a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt +++ b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt @@ -15,8 +15,11 @@ */ package com.mongodb.kotlin.client.coroutine +import com.mongodb.ClientSessionOptions +import com.mongodb.MongoClientSettings 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 @@ -78,8 +81,8 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) { * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] (current) * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * @@ -146,8 +149,8 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) { * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] (current) * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * diff --git a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt index 5143d14908d..7b7dbd9e265 100644 --- a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt +++ b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/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 @@ -83,8 +84,8 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo * - [MongoCluster.withTimeout] (current) * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * @@ -154,8 +155,8 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo * - [MongoCluster.withTimeout] (current) * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * @@ -421,9 +422,9 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo /** * Executes a client-level bulk write operation. * - * This operation supports [retryable writes][com.mongodb.MongoClientSettings.getRetryWrites]. Depending on the - * number of `models`, encoded size of `models`, and the size limits in effect, executing this operation may require - * multiple `bulkWrite` commands. The eligibility for retries is determined per each `bulkWrite` command: + * This operation supports [retryable writes][MongoClientSettings.getRetryWrites]. Depending on the number of + * `models`, encoded size of `models`, and the size limits in effect, executing this operation may require multiple + * `bulkWrite` commands. The eligibility for retries is determined per each `bulkWrite` command: * [ClientNamespacedUpdateManyModel], [ClientNamespacedDeleteManyModel] in a command render it non-retryable. * * @param clientSession The [client session][ClientSession] with which to associate this operation. diff --git a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt index 9b9d0cf4b81..580abe2a16f 100644 --- a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt +++ b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt @@ -15,9 +15,12 @@ */ package com.mongodb.kotlin.client +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 @@ -107,8 +110,8 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] (current) - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * @@ -163,7 +166,7 @@ public class MongoCollection(private val wrapped: JMongoCollection) /** * Create a new collection instance with a different read preference. * - * @param newReadPreference the new [com.mongodb.ReadPreference] for the collection + * @param newReadPreference the new [ReadPreference] for the collection * @return a new MongoCollection instance with the different readPreference */ public fun withReadPreference(newReadPreference: ReadPreference): MongoCollection = @@ -182,7 +185,7 @@ public class MongoCollection(private val wrapped: JMongoCollection) /** * Create a new collection instance with a different write concern. * - * @param newWriteConcern the new [com.mongodb.WriteConcern] for the collection + * @param newWriteConcern the new [WriteConcern] for the collection * @return a new MongoCollection instance with the different writeConcern */ public fun withWriteConcern(newWriteConcern: WriteConcern): MongoCollection = @@ -198,8 +201,8 @@ public class MongoCollection(private val wrapped: JMongoCollection) * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] * - [MongoCollection.withTimeout] (current) - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * diff --git a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt index e8fd7532553..a42b7e1be4e 100644 --- a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt +++ b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt @@ -15,8 +15,11 @@ */ package com.mongodb.kotlin.client +import com.mongodb.ClientSessionOptions +import com.mongodb.MongoClientSettings 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 @@ -76,8 +79,8 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) { * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] (current) * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. * @@ -147,8 +150,8 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) { * - [MongoCluster.withTimeout] * - [MongoDatabase.withTimeout] (current) * - [MongoCollection.withTimeout] - * - [com.mongodb.ClientSessionOptions.Builder.defaultTimeout] - * - [com.mongodb.TransactionOptions.Builder.timeout] + * - [ClientSessionOptions.Builder.defaultTimeout] + * - [TransactionOptions.Builder.timeout] * * If not set at a given level, the timeout is inherited from the level above. *