Packages

case class GridFSBucket(wrapped: com.mongodb.reactivestreams.client.gridfs.GridFSBucket) extends Product with Serializable

Represents a GridFS Bucket

Since

1.2

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GridFSBucket
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new GridFSBucket(wrapped: com.mongodb.reactivestreams.client.gridfs.GridFSBucket)

Value Members

  1. lazy val bucketName: String

    The bucket name.

    The bucket name.

    returns

    the bucket name

  2. lazy val chunkSizeBytes: Int

    Sets the chunk size in bytes.

    Sets the chunk size in bytes. Defaults to 255.

    returns

    the chunk size in bytes.

  3. def delete(clientSession: ClientSession, id: BsonValue): SingleObservable[Unit]

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    clientSession

    the client session with which to associate this operation

    id

    the ObjectId of the file to be deleted

    returns

    an Observable that indicates when the operation has completed

    Since

    2.2

    Note

    Requires MongoDB 3.6 or greater

  4. def delete(clientSession: ClientSession, id: ObjectId): SingleObservable[Unit]

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    clientSession

    the client session with which to associate this operation

    id

    the ObjectId of the file to be deleted

    returns

    an Observable that indicates when the operation has completed

    Since

    2.2

    Note

    Requires MongoDB 3.6 or greater

  5. def delete(id: BsonValue): SingleObservable[Unit]

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    id

    the ObjectId of the file to be deleted

    returns

    an Observable that indicates when the operation has completed

  6. def delete(id: ObjectId): SingleObservable[Unit]

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket.

    id

    the ObjectId of the file to be deleted

    returns

    an Observable that indicates when the operation has completed

  7. def downloadToObservable(clientSession: ClientSession, filename: String, options: GridFSDownloadOptions): GridFSDownloadObservable

    Downloads the contents of the stored file specified by filename and by the revision in options into the Publisher.

    Downloads the contents of the stored file specified by filename and by the revision in options into the Publisher.

    clientSession

    the client session with which to associate this operation

    filename

    the name of the file to be downloaded

    options

    the download options

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  8. def downloadToObservable(clientSession: ClientSession, filename: String): GridFSDownloadObservable

    Downloads the contents of the latest version of the stored file specified by filename into the Publisher.

    Downloads the contents of the latest version of the stored file specified by filename into the Publisher.

    clientSession

    the client session with which to associate this operation

    filename

    the name of the file to be downloaded

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  9. def downloadToObservable(clientSession: ClientSession, id: BsonValue): GridFSDownloadObservable

    Downloads the contents of the stored file specified by id into the Publisher.

    Downloads the contents of the stored file specified by id into the Publisher.

    clientSession

    the client session with which to associate this operation

    id

    the custom id of the file, to be written to the destination stream

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  10. def downloadToObservable(clientSession: ClientSession, id: ObjectId): GridFSDownloadObservable

    Downloads the contents of the stored file specified by id into the Publisher.

    Downloads the contents of the stored file specified by id into the Publisher.

    clientSession

    the client session with which to associate this operation

    id

    the ObjectId of the file to be written to the destination stream

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  11. def downloadToObservable(filename: String, options: GridFSDownloadOptions): GridFSDownloadObservable

    Downloads the contents of the stored file specified by filename and by the revision in options into the Publisher.

    Downloads the contents of the stored file specified by filename and by the revision in options into the Publisher.

    filename

    the name of the file to be downloaded

    options

    the download options

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

  12. def downloadToObservable(filename: String): GridFSDownloadObservable

    Downloads the contents of the stored file specified by filename into the Publisher.

    Downloads the contents of the stored file specified by filename into the Publisher.

    filename

    the name of the file to be downloaded

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

  13. def downloadToObservable(id: BsonValue): GridFSDownloadObservable

    Downloads the contents of the stored file specified by id into the Publisher.

    Downloads the contents of the stored file specified by id into the Publisher.

    id

    the custom id of the file, to be written to the destination stream

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

  14. def downloadToObservable(id: ObjectId): GridFSDownloadObservable

    Downloads the contents of the stored file specified by id into the Publisher.

    Downloads the contents of the stored file specified by id into the Publisher.

    id

    the ObjectId of the file to be written to the destination stream

    returns

    an Observable with a single element, representing the amount of data written

    Since

    2.8

  15. def drop(clientSession: ClientSession): SingleObservable[Unit]

    Drops the data associated with this bucket from the database.

    Drops the data associated with this bucket from the database.

    clientSession

    the client session with which to associate this operation

    returns

    an Observable that indicates when the operation has completed

    Since

    2.2

    Note

    Requires MongoDB 3.6 or greater

  16. def drop(): SingleObservable[Unit]

    Drops the data associated with this bucket from the database.

    Drops the data associated with this bucket from the database.

    returns

    an Observable that indicates when the operation has completed

  17. def find(clientSession: ClientSession, filter: Bson): GridFSFindObservable

    Finds all documents in the collection that match the filter.

    Finds all documents in the collection that match the filter.

    Below is an example of filtering against the filename and some nested metadata that can also be stored along with the file data:

    Filters.and(Filters.eq("filename", "mongodb.png"), Filters.eq("metadata.contentType", "image/png"));

    clientSession

    the client session with which to associate this operation

    filter

    the query filter

    returns

    the GridFS find iterable interface

    Since

    2.2

    Note

    Requires MongoDB 3.6 or greater

    See also

    com.mongodb.client.model.Filters

  18. def find(clientSession: ClientSession): GridFSFindObservable

    Finds all documents in the files collection.

    Finds all documents in the files collection.

    clientSession

    the client session with which to associate this operation

    returns

    the GridFS find iterable interface

    Since

    2.2

    Note

    Requires MongoDB 3.6 or greater

    See also

    Find

  19. def find(filter: Bson): GridFSFindObservable

    Finds all documents in the collection that match the filter.

    Finds all documents in the collection that match the filter.

    Below is an example of filtering against the filename and some nested metadata that can also be stored along with the file data:

    Filters.and(Filters.eq("filename", "mongodb.png"), Filters.eq("metadata.contentType", "image/png"));

    filter

    the query filter

    returns

    the GridFS find iterable interface

    See also

    com.mongodb.client.model.Filters

  20. def find(): GridFSFindObservable

    Finds all documents in the files collection.

    Finds all documents in the files collection.

    returns

    the GridFS find iterable interface

    See also

    Find

  21. def productElementNames: Iterator[String]
    Definition Classes
    Product
  22. lazy val readConcern: ReadConcern

    Get the read concern for the GridFSBucket.

    Get the read concern for the GridFSBucket.

    returns

    the ReadConcern

    Note

    Requires MongoDB 3.2 or greater

    See also

    Read Concern

  23. lazy val readPreference: ReadPreference

    Get the read preference for the GridFSBucket.

    Get the read preference for the GridFSBucket.

    returns

    the ReadPreference

  24. def rename(clientSession: ClientSession, id: BsonValue, newFilename: String): SingleObservable[Unit]

    Renames the stored file with the specified id.

    Renames the stored file with the specified id.

    clientSession

    the client session with which to associate this operation

    id

    the id of the file in the files collection to rename

    newFilename

    the new filename for the file

    returns

    an Observable that indicates when the operation has completed

    Since

    2.2

    Note

    Requires MongoDB 3.6 or greater

  25. def rename(clientSession: ClientSession, id: ObjectId, newFilename: String): SingleObservable[Unit]

    Renames the stored file with the specified id.

    Renames the stored file with the specified id.

    clientSession

    the client session with which to associate this operation

    id

    the id of the file in the files collection to rename

    newFilename

    the new filename for the file

    returns

    an Observable that indicates when the operation has completed

    Since

    2.2

    Note

    Requires MongoDB 3.6 or greater

  26. def rename(id: BsonValue, newFilename: String): SingleObservable[Unit]

    Renames the stored file with the specified id.

    Renames the stored file with the specified id.

    id

    the id of the file in the files collection to rename

    newFilename

    the new filename for the file

    returns

    an Observable that indicates when the operation has completed

  27. def rename(id: ObjectId, newFilename: String): SingleObservable[Unit]

    Renames the stored file with the specified id.

    Renames the stored file with the specified id.

    id

    the id of the file in the files collection to rename

    newFilename

    the new filename for the file

    returns

    an Observable that indicates when the operation has completed

  28. lazy val timeout: Option[Duration]

    The time limit for the full execution of an operation.

    The time limit for the full execution of an operation.

    If not null the following deprecated options will be ignored: waitQueueTimeoutMS, socketTimeoutMS, wTimeoutMS, maxTimeMS and maxCommitTimeMS.

    • null means that the timeout mechanism for operations will defer to using:
      • waitQueueTimeoutMS: The maximum wait time in milliseconds that a thread may wait for a connection to become available
      • socketTimeoutMS: How long a send or receive on a socket can take before timing out.
      • wTimeoutMS: How long the server will wait for the write concern to be fulfilled before timing out.
      • maxTimeMS: The time limit for processing operations on a cursor. See: [cursor.maxTimeMS](https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS").
      • maxCommitTimeMS: The maximum amount of time to allow a single commitTransaction command to execute.
    • 0 means infinite timeout.
    • > 0 The time limit to use for the full execution of an operation.
    returns

    the optional timeout duration

    Annotations
    @Alpha()
    Since

    5.2

  29. def uploadFromObservable(clientSession: ClientSession, id: BsonValue, filename: String, source: Observable[ByteBuffer], options: GridFSUploadOptions): GridFSUploadObservable[Unit]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    clientSession

    the client session with which to associate this operation

    id

    the custom id value of the file

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    options

    the GridFSUploadOptions

    returns

    an Observable representing when the successful upload of the source.

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  30. def uploadFromObservable(clientSession: ClientSession, id: BsonValue, filename: String, source: Observable[ByteBuffer]): GridFSUploadObservable[Unit]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    clientSession

    the client session with which to associate this operation

    id

    the custom id value of the file

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    returns

    an Observable representing when the successful upload of the source.

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  31. def uploadFromObservable(clientSession: ClientSession, filename: String, source: Observable[ByteBuffer], options: GridFSUploadOptions): GridFSUploadObservable[ObjectId]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    clientSession

    the client session with which to associate this operation

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    options

    the GridFSUploadOptions

    returns

    an Observable with a single element, the ObjectId of the uploaded file.

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  32. def uploadFromObservable(clientSession: ClientSession, filename: String, source: Observable[ByteBuffer]): GridFSUploadObservable[ObjectId]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    clientSession

    the client session with which to associate this operation

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    returns

    an Observable with a single element, the ObjectId of the uploaded file.

    Since

    2.8

    Note

    Requires MongoDB 3.6 or greater

  33. def uploadFromObservable(id: BsonValue, filename: String, source: Observable[ByteBuffer], options: GridFSUploadOptions): GridFSUploadObservable[Unit]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    id

    the custom id value of the file

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    options

    the GridFSUploadOptions

    returns

    an Observable representing when the successful upload of the source.

    Since

    2.8

  34. def uploadFromObservable(id: BsonValue, filename: String, source: Observable[ByteBuffer]): GridFSUploadObservable[Unit]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    id

    the custom id value of the file

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    returns

    an Observable representing when the successful upload of the source.

    Since

    2.8

  35. def uploadFromObservable(filename: String, source: Observable[ByteBuffer], options: GridFSUploadOptions): GridFSUploadObservable[ObjectId]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    options

    the GridFSUploadOptions

    returns

    an Observable with a single element, the ObjectId of the uploaded file.

    Since

    2.8

  36. def uploadFromObservable(filename: String, source: Observable[ByteBuffer]): GridFSUploadObservable[ObjectId]

    Uploads the contents of the given Observable to a GridFS bucket.

    Uploads the contents of the given Observable to a GridFS bucket.

    Reads the contents of the user file from the source and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for filename in the files collection.

    Note: When this GridFSBucket is set with a operation timeout (via timeout inherited from MongoDatabase settings or withTimeout), timeout breaches may occur due to the Observable lacking inherent read timeout support, which might extend the operation beyond the specified timeout limit.

    filename

    the filename for the stream

    source

    the Publisher providing the file data

    returns

    an Observable with a single element, the ObjectId of the uploaded file.

    Since

    2.8

  37. def withChunkSizeBytes(chunkSizeBytes: Int): GridFSBucket

    Create a new GridFSBucket instance with a new chunk size in bytes.

    Create a new GridFSBucket instance with a new chunk size in bytes.

    chunkSizeBytes

    the new chunk size in bytes.

    returns

    a new GridFSBucket instance with the different chunk size in bytes

  38. def withReadConcern(readConcern: ReadConcern): GridFSBucket

    Create a new MongoDatabase instance with a different read concern.

    Create a new MongoDatabase instance with a different read concern.

    readConcern

    the new ReadConcern for the database

    returns

    a new GridFSBucket instance with the different ReadConcern

    Note

    Requires MongoDB 3.2 or greater

    See also

    Read Concern

  39. def withReadPreference(readPreference: ReadPreference): GridFSBucket

    Create a new GridFSBucket instance with a different read preference.

    Create a new GridFSBucket instance with a different read preference.

    readPreference

    the new ReadPreference for the database

    returns

    a new GridFSBucket instance with the different readPreference

  40. def withTimeout(timeout: Duration): GridFSBucket

    Sets the time limit for the full execution of an operation.

    Sets the time limit for the full execution of an operation.

    - 0 means infinite timeout. - > 0 The time limit to use for the full execution of an operation.

    timeout

    the timeout, which must be greater than or equal to 0

    returns

    a new GridFSBucket instance with the set time limit for operations

    Annotations
    @Alpha()
    Since

    5.2

  41. def withWriteConcern(writeConcern: WriteConcern): GridFSBucket

    Create a new GridFSBucket instance with a different write concern.

    Create a new GridFSBucket instance with a different write concern.

    writeConcern

    the new WriteConcern for the database

    returns

    a new GridFSBucket instance with the different writeConcern

  42. lazy val writeConcern: WriteConcern

    Get the write concern for the GridFSBucket.

    Get the write concern for the GridFSBucket.

    returns

    the WriteConcern