Skip to content

Commit 45895b2

Browse files
authored
Updated the javadoc for runCommand. (#1323)
Now uses the language of the Spec. Which will fall into line with JAVA-5322 delayed setting of maxtimems. JAVA-5098
1 parent d5acd00 commit 45895b2

File tree

5 files changed

+82
-8
lines changed

5 files changed

+82
-8
lines changed

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MongoDatabase.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
185185
/**
186186
* Executes the given command in the context of the current database with the given read preference.
187187
*
188+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
189+
* `timeoutMS` setting has been set.
190+
*
188191
* @param T the class to decode each document into
189192
* @param command the command to be run
190193
* @param readPreference the [ReadPreference] to be used when executing the command, defaults to
@@ -201,6 +204,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
201204
/**
202205
* Executes the given command in the context of the current database with the given read preference.
203206
*
207+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
208+
* `timeoutMS` setting has been set.
209+
*
204210
* @param T the class to decode each document into
205211
* @param clientSession the client session with which to associate this operation
206212
* @param command the command to be run
@@ -219,6 +225,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
219225
/**
220226
* Executes the given command in the context of the current database with the given read preference.
221227
*
228+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
229+
* `timeoutMS` setting has been set.
230+
*
222231
* @param T the class to decode each document into
223232
* @param command the command to be run
224233
* @param readPreference the [ReadPreference] to be used when executing the command, defaults to
@@ -233,6 +242,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
233242
/**
234243
* Executes the given command in the context of the current database with the given read preference.
235244
*
245+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
246+
* `timeoutMS` setting has been set.
247+
*
236248
* @param T the class to decode each document into
237249
* @param clientSession the client session with which to associate this operation
238250
* @param command the command to be run

driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
155155
/**
156156
* Executes the given command in the context of the current database with the given read preference.
157157
*
158+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
159+
* `timeoutMS` setting has been set.
160+
*
158161
* @param command the command to be run
159162
* @param readPreference the [ReadPreference] to be used when executing the command, defaults to
160163
* [MongoDatabase.readPreference]
@@ -166,6 +169,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
166169
/**
167170
* Executes the given command in the context of the current database with the given read preference.
168171
*
172+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
173+
* `timeoutMS` setting has been set.
174+
*
169175
* @param clientSession the client session with which to associate this operation
170176
* @param command the command to be run
171177
* @param readPreference the [ReadPreference] to be used when executing the command, defaults to
@@ -181,6 +187,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
181187
/**
182188
* Executes the given command in the context of the current database with the given read preference.
183189
*
190+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
191+
* `timeoutMS` setting has been set.
192+
*
184193
* @param T the class to decode each document into
185194
* @param command the command to be run
186195
* @param readPreference the [ReadPreference] to be used when executing the command, defaults to
@@ -197,6 +206,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
197206
/**
198207
* Executes the given command in the context of the current database with the given read preference.
199208
*
209+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
210+
* `timeoutMS` setting has been set.
211+
*
200212
* @param T the class to decode each document into
201213
* @param clientSession the client session with which to associate this operation
202214
* @param command the command to be run
@@ -215,6 +227,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
215227
/**
216228
* Executes the given command in the context of the current database with the given read preference.
217229
*
230+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
231+
* `timeoutMS` setting has been set.
232+
*
218233
* @param T the class to decode each document into
219234
* @param command the command to be run
220235
* @param readPreference the [ReadPreference] to be used when executing the command, defaults to
@@ -229,6 +244,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
229244
/**
230245
* Executes the given command in the context of the current database with the given read preference.
231246
*
247+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
248+
* `timeoutMS` setting has been set.
249+
*
232250
* @param T the class to decode each document into
233251
* @param clientSession the client session with which to associate this operation
234252
* @param command the command to be run

driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoDatabase.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ public interface MongoDatabase {
183183
/**
184184
* Executes command in the context of the current database.
185185
*
186+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
187+
* {@code timeoutMS} setting has been set.</p>
188+
*
186189
* @param command the command to be run
187190
* @return a publisher containing the command result
188191
*/
@@ -191,6 +194,9 @@ public interface MongoDatabase {
191194
/**
192195
* Executes command in the context of the current database.
193196
*
197+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
198+
* {@code timeoutMS} setting has been set.</p>
199+
*
194200
* @param command the command to be run
195201
* @param readPreference the {@link com.mongodb.ReadPreference} to be used when executing the command
196202
* @return a publisher containing the command result
@@ -200,6 +206,9 @@ public interface MongoDatabase {
200206
/**
201207
* Executes command in the context of the current database.
202208
*
209+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
210+
* {@code timeoutMS} setting has been set.</p>
211+
*
203212
* @param command the command to be run
204213
* @param clazz the default class to cast any documents returned from the database into.
205214
* @param <TResult> the type of the class to use instead of {@code Document}.
@@ -210,6 +219,9 @@ public interface MongoDatabase {
210219
/**
211220
* Executes command in the context of the current database.
212221
*
222+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
223+
* {@code timeoutMS} setting has been set.</p>
224+
*
213225
* @param command the command to be run
214226
* @param readPreference the {@link com.mongodb.ReadPreference} to be used when executing the command
215227
* @param clazz the default class to cast any documents returned from the database into.
@@ -221,6 +233,9 @@ public interface MongoDatabase {
221233
/**
222234
* Executes command in the context of the current database.
223235
*
236+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
237+
* {@code timeoutMS} setting has been set.</p>
238+
*
224239
* @param clientSession the client session with which to associate this operation
225240
* @param command the command to be run
226241
* @return a publisher containing the command result
@@ -232,6 +247,9 @@ public interface MongoDatabase {
232247
/**
233248
* Executes command in the context of the current database.
234249
*
250+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
251+
* {@code timeoutMS} setting has been set.</p>
252+
*
235253
* @param clientSession the client session with which to associate this operation
236254
* @param command the command to be run
237255
* @param readPreference the {@link com.mongodb.ReadPreference} to be used when executing the command
@@ -244,6 +262,9 @@ public interface MongoDatabase {
244262
/**
245263
* Executes command in the context of the current database.
246264
*
265+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
266+
* {@code timeoutMS} setting has been set.</p>
267+
*
247268
* @param clientSession the client session with which to associate this operation
248269
* @param command the command to be run
249270
* @param clazz the default class to cast any documents returned from the database into.
@@ -257,6 +278,9 @@ public interface MongoDatabase {
257278
/**
258279
* Executes command in the context of the current database.
259280
*
281+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
282+
* {@code timeoutMS} setting has been set.</p>
283+
*
260284
* @param clientSession the client session with which to associate this operation
261285
* @param command the command to be run
262286
* @param readPreference the {@link com.mongodb.ReadPreference} to be used when executing the command

driver-scala/src/main/scala/org/mongodb/scala/MongoDatabase.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ case class MongoDatabase(private[scala] val wrapped: JMongoDatabase) {
164164
/**
165165
* Executes command in the context of the current database using the primary server.
166166
*
167+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
168+
* `timeoutMS` setting has been set.
169+
*
167170
* @param command the command to be run
168171
* @tparam TResult the type of the class to use instead of [[Document]].
169172
* @return a Observable containing the command result
@@ -176,6 +179,9 @@ case class MongoDatabase(private[scala] val wrapped: JMongoDatabase) {
176179
/**
177180
* Executes command in the context of the current database.
178181
*
182+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
183+
* `timeoutMS` setting has been set.
184+
*
179185
* @param command the command to be run
180186
* @param readPreference the [[ReadPreference]] to be used when executing the command
181187
* @tparam TResult the type of the class to use instead of [[Document]].
@@ -190,6 +196,9 @@ case class MongoDatabase(private[scala] val wrapped: JMongoDatabase) {
190196
/**
191197
* Executes command in the context of the current database using the primary server.
192198
*
199+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
200+
* `timeoutMS` setting has been set.
201+
*
193202
* @param clientSession the client session with which to associate this operation
194203
* @param command the command to be run
195204
* @tparam TResult the type of the class to use instead of [[Document]].
@@ -206,6 +215,9 @@ case class MongoDatabase(private[scala] val wrapped: JMongoDatabase) {
206215
/**
207216
* Executes command in the context of the current database.
208217
*
218+
* Note: The behavior of `runCommand` is undefined if the provided command document includes a `maxTimeMS` field and the
219+
* `timeoutMS` setting has been set.
220+
*
209221
* @param command the command to be run
210222
* @param readPreference the [[ReadPreference]] to be used when executing the command
211223
* @tparam TResult the type of the class to use instead of [[Document]].

driver-sync/src/main/com/mongodb/client/MongoDatabase.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ public interface MongoDatabase {
188188
/**
189189
* Executes the given command in the context of the current database with a read preference of {@link ReadPreference#primary()}.
190190
*
191-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
191+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
192+
* {@code timeoutMS} setting has been set.</p>
192193
*
193194
* @param command the command to be run
194195
* @return the command result
@@ -198,7 +199,8 @@ public interface MongoDatabase {
198199
/**
199200
* Executes the given command in the context of the current database with the given read preference.
200201
*
201-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
202+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
203+
* {@code timeoutMS} setting has been set.</p>
202204
*
203205
* @param command the command to be run
204206
* @param readPreference the {@link ReadPreference} to be used when executing the command
@@ -209,7 +211,8 @@ public interface MongoDatabase {
209211
/**
210212
* Executes the given command in the context of the current database with a read preference of {@link ReadPreference#primary()}.
211213
*
212-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
214+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
215+
* {@code timeoutMS} setting has been set.</p>
213216
*
214217
* @param command the command to be run
215218
* @param resultClass the class to decode each document into
@@ -221,7 +224,8 @@ public interface MongoDatabase {
221224
/**
222225
* Executes the given command in the context of the current database with the given read preference.
223226
*
224-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
227+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
228+
* {@code timeoutMS} setting has been set.</p>
225229
*
226230
* @param command the command to be run
227231
* @param readPreference the {@link ReadPreference} to be used when executing the command
@@ -234,7 +238,8 @@ public interface MongoDatabase {
234238
/**
235239
* Executes the given command in the context of the current database with a read preference of {@link ReadPreference#primary()}.
236240
*
237-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
241+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
242+
* {@code timeoutMS} setting has been set.</p>
238243
*
239244
* @param clientSession the client session with which to associate this operation
240245
* @param command the command to be run
@@ -247,7 +252,8 @@ public interface MongoDatabase {
247252
/**
248253
* Executes the given command in the context of the current database with the given read preference.
249254
*
250-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
255+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
256+
* {@code timeoutMS} setting has been set.</p>
251257
*
252258
* @param clientSession the client session with which to associate this operation
253259
* @param command the command to be run
@@ -261,7 +267,8 @@ public interface MongoDatabase {
261267
/**
262268
* Executes the given command in the context of the current database with a read preference of {@link ReadPreference#primary()}.
263269
*
264-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
270+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
271+
* {@code timeoutMS} setting has been set.</p>
265272
*
266273
* @param clientSession the client session with which to associate this operation
267274
* @param command the command to be run
@@ -276,7 +283,8 @@ public interface MongoDatabase {
276283
/**
277284
* Executes the given command in the context of the current database with the given read preference.
278285
*
279-
* <p>Note: If set the {@link #getTimeout} value will overwrite any {@code maxTimeMS} value in the command.</p>
286+
* <p>Note: The behavior of {@code runCommand} is undefined if the provided command document includes a {@code maxTimeMS} field and the
287+
* {@code timeoutMS} setting has been set.</p>
280288
*
281289
* @param clientSession the client session with which to associate this operation
282290
* @param command the command to be run

0 commit comments

Comments
 (0)