case class GridFSBucket(wrapped: com.mongodb.reactivestreams.client.gridfs.GridFSBucket) extends Product with Serializable
Represents a GridFS Bucket
- Since
1.2
- Alphabetic
- By Inheritance
- GridFSBucket
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new GridFSBucket(wrapped: com.mongodb.reactivestreams.client.gridfs.GridFSBucket)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- lazy val bucketName: String
The bucket name.
The bucket name.
- returns
the bucket name
- 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.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- def delete(clientSession: ClientSession, id: BsonValue): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- Since
2.2
- Note
Requires MongoDB 3.6 or greater
- def delete(clientSession: ClientSession, id: ObjectId): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- Since
2.2
- Note
Requires MongoDB 3.6 or greater
- def delete(id: BsonValue): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- def delete(id: ObjectId): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- def downloadToObservable(clientSession: ClientSession, filename: String, options: GridFSDownloadOptions): GridFSDownloadObservable
Downloads the contents of the stored file specified by
filename
and by the revision inoptions
into thePublisher
.Downloads the contents of the stored file specified by
filename
and by the revision inoptions
into thePublisher
.- 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
- def downloadToObservable(clientSession: ClientSession, filename: String): GridFSDownloadObservable
Downloads the contents of the latest version of the stored file specified by
filename
into thePublisher
.Downloads the contents of the latest version of the stored file specified by
filename
into thePublisher
.- 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
- def downloadToObservable(clientSession: ClientSession, id: BsonValue): GridFSDownloadObservable
Downloads the contents of the stored file specified by
id
into thePublisher
.Downloads the contents of the stored file specified by
id
into thePublisher
.- 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
- def downloadToObservable(clientSession: ClientSession, id: ObjectId): GridFSDownloadObservable
Downloads the contents of the stored file specified by
id
into thePublisher
.Downloads the contents of the stored file specified by
id
into thePublisher
.- 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
- def downloadToObservable(filename: String, options: GridFSDownloadOptions): GridFSDownloadObservable
Downloads the contents of the stored file specified by
filename
and by the revision inoptions
into thePublisher
.Downloads the contents of the stored file specified by
filename
and by the revision inoptions
into thePublisher
.- 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
- def downloadToObservable(filename: String): GridFSDownloadObservable
Downloads the contents of the stored file specified by
filename
into thePublisher
.Downloads the contents of the stored file specified by
filename
into thePublisher
.- 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
- def downloadToObservable(id: BsonValue): GridFSDownloadObservable
Downloads the contents of the stored file specified by
id
into thePublisher
.Downloads the contents of the stored file specified by
id
into thePublisher
.- 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
- def downloadToObservable(id: ObjectId): GridFSDownloadObservable
Downloads the contents of the stored file specified by
id
into thePublisher
.Downloads the contents of the stored file specified by
id
into thePublisher
.- 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
- def drop(clientSession: ClientSession): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- Since
2.2
- Note
Requires MongoDB 3.6 or greater
- def drop(): SingleObservable[Void]
Drops the data associated with this bucket from the database.
Drops the data associated with this bucket from the database.
- returns
an empty Observable that indicates when the operation has completed
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- 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
- 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
- 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
- def find(): GridFSFindObservable
Finds all documents in the files collection.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- 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
- lazy val readPreference: ReadPreference
Get the read preference for the GridFSBucket.
Get the read preference for the GridFSBucket.
- returns
the ReadPreference
- def rename(clientSession: ClientSession, id: BsonValue, newFilename: String): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- Since
2.2
- Note
Requires MongoDB 3.6 or greater
- def rename(clientSession: ClientSession, id: ObjectId, newFilename: String): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- Since
2.2
- Note
Requires MongoDB 3.6 or greater
- def rename(id: BsonValue, newFilename: String): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- def rename(id: ObjectId, newFilename: String): SingleObservable[Void]
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 empty Observable that indicates when the operation has completed
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def uploadFromObservable(clientSession: ClientSession, id: BsonValue, filename: String, source: Observable[ByteBuffer], options: GridFSUploadOptions): GridFSUploadObservable[Void]
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 forfilename
in the files collection.- 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 with a single element, representing when the successful upload of the source.
- Since
2.8
- Note
Requires MongoDB 3.6 or greater
- def uploadFromObservable(clientSession: ClientSession, id: BsonValue, filename: String, source: Observable[ByteBuffer]): GridFSUploadObservable[Void]
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 forfilename
in the files collection.- 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 with a single element, representing when the successful upload of the source.
- Since
2.8
- Note
Requires MongoDB 3.6 or greater
- 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 forfilename
in the files collection.- 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
- 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 forfilename
in the files collection.- 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
- def uploadFromObservable(id: BsonValue, filename: String, source: Observable[ByteBuffer], options: GridFSUploadOptions): GridFSUploadObservable[Void]
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 forfilename
in the files collection.- 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 with a single element, representing when the successful upload of the source.
- Since
2.8
- def uploadFromObservable(id: BsonValue, filename: String, source: Observable[ByteBuffer]): GridFSUploadObservable[Void]
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 forfilename
in the files collection.- id
the custom id value of the file
- filename
the filename for the stream
- source
the Publisher providing the file data
- returns
an Observable with a single element, representing when the successful upload of the source.
- Since
2.8
- 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 forfilename
in the files collection.- 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
- 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 forfilename
in the files collection.- 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
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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
- 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
- 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
- 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
- lazy val writeConcern: WriteConcern
Get the write concern for the GridFSBucket.
Get the write concern for the GridFSBucket.
- returns
the WriteConcern
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: