@@ -274,6 +274,35 @@ inherited timeout:
274274 :dedent:
275275 :emphasize-lines: 3
276276
277+ .. _scala-csot-gridfs:
278+
279+ GridFS
280+ ------
281+
282+ You can set a timeout option for :ref:`GridFS <scala-gridfs>`
283+ operations when instantiating a ``GridFSBucket`` by using the
284+ ``withTimeout()`` method. This timeout applies to all operations
285+ performed on the bucket, such as uploading and downloading data. If you
286+ do not set a timeout, the ``GridFSBucket`` instance inherits the timeout
287+ setting from the ``MongoDatabase`` it is created with.
288+
289+ The following code demonstrates how to set a timeout when instantiating
290+ a ``GridFSBucket``:
291+
292+ .. literalinclude:: /includes/connect/CsotExample.scala
293+ :language: scala
294+ :start-after: start-gridfsbucket-timeout
295+ :end-before: end-gridfsbucket-timeout
296+ :dedent:
297+
298+ .. important:: Observable Timeout Support
299+
300+ When you call the ``uploadFromObservable()`` method on a ``GridFSBucket``
301+ that has an operation timeout, timeout breaches might occur because
302+ the ``Observable`` class lacks inherent read timeout support. This might
303+ extend the operation beyond the specified timeout limit, causing a
304+ timeout exception.
305+
277306API Documentation
278307-----------------
279308
@@ -288,3 +317,4 @@ API documentation:
288317- `ClientEncryptionSettings.Builder.timeout() <{+core-api+}/com/mongodb/ClientEncryptionSettings.Builder.html#timeout(long,java.util.concurrent.TimeUnit)>`__
289318- `FindIterable.timeoutMode() <{+api+}/org/mongodb/scala/FindObservable.html#timeoutMode(timeoutMode:org.mongodb.scala.TimeoutMode):org.mongodb.scala.FindObservable[TResult]>`__
290319- `TimeoutMode <{+core-api+}/com/mongodb/client/cursor/TimeoutMode.html>`__
320+ - `GridFSBucket.withTimeout() <{+api+}/org/mongodb/scala/gridfs/GridFSBucket.html#withTimeout(timeout:scala.concurrent.duration.Duration):org.mongodb.scala.gridfs.GridFSBucket>`__
0 commit comments