Interface GridFSBucket
-
public interface GridFSBucket
Represents a GridFS Bucket- Since:
- 1.3
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static GridFSBucket
create(MongoDatabase database)
static GridFSBucket
create(MongoDatabase database, java.lang.String bucketName)
Future<java.lang.Void>
delete(ClientSession clientSession, ObjectId id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.void
delete(ClientSession clientSession, ObjectId id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.Future<java.lang.Void>
delete(ClientSession clientSession, java.lang.Object id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.void
delete(ClientSession clientSession, java.lang.Object id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.Future<java.lang.Void>
delete(ObjectId id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.void
delete(ObjectId id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.Future<java.lang.Void>
delete(java.lang.Object id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.void
delete(java.lang.Object id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.GridFSDownloadResult
downloadByFilename(ClientSession clientSession, java.lang.String filename)
Downloads the contents of the latest version of the stored file specified byfilename
into thePublisher
.GridFSDownloadResult
downloadByFilename(ClientSession clientSession, java.lang.String filename, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the latest version of the stored file specified byfilename
into thePublisher
.GridFSDownloadResult
downloadByFilename(ClientSession clientSession, java.lang.String filename, GridFSDownloadOptions options)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.GridFSDownloadResult
downloadByFilename(ClientSession clientSession, java.lang.String filename, GridFSDownloadOptions options, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.GridFSDownloadResult
downloadByFilename(java.lang.String filename)
Downloads the contents of the stored file specified byfilename
into thePublisher
.GridFSDownloadResult
downloadByFilename(java.lang.String filename, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byfilename
into thePublisher
.GridFSDownloadResult
downloadByFilename(java.lang.String filename, GridFSDownloadOptions options)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.GridFSDownloadResult
downloadByFilename(java.lang.String filename, GridFSDownloadOptions options, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.GridFSDownloadResult
downloadByObjectId(ClientSession clientSession, ObjectId id)
Downloads the contents of the stored file specified byid
into thePublisher
.GridFSDownloadResult
downloadByObjectId(ClientSession clientSession, ObjectId id, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byid
into thePublisher
.GridFSDownloadResult
downloadByObjectId(ObjectId id)
Downloads the contents of the stored file specified byid
into thePublisher
.GridFSDownloadResult
downloadByObjectId(ObjectId id, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byid
into thePublisher
.Future<java.lang.Void>
drop()
Drops the data associated with this bucket from the database.void
drop(Handler<AsyncResult<java.lang.Void>> resultHandler)
Drops the data associated with this bucket from the database.Future<java.lang.Void>
drop(ClientSession clientSession)
Drops the data associated with this bucket from the database.void
drop(ClientSession clientSession, Handler<AsyncResult<java.lang.Void>> resultHandler)
Drops the data associated with this bucket from the database.MongoResult<GridFSFile>
find()
Finds all documents in the files collection.MongoResult<GridFSFile>
find(JsonObject filter)
Finds all documents in the collection that match the filter.MongoResult<GridFSFile>
find(JsonObject filter, GridFSFindOptions options)
Finds all documents in the collection that match the filter.MongoResult<GridFSFile>
find(ClientSession clientSession)
Finds all documents in the files collection.MongoResult<GridFSFile>
find(ClientSession clientSession, JsonObject filter)
Finds all documents in the collection that match the filter.MongoResult<GridFSFile>
find(ClientSession clientSession, JsonObject filter, GridFSFindOptions options)
Finds all documents in the collection that match the filter.MongoResult<GridFSFile>
find(ClientSession clientSession, GridFSFindOptions options)
Finds all documents in the files collection.MongoResult<GridFSFile>
find(GridFSFindOptions options)
Finds all documents in the files collection.java.lang.String
getBucketName()
The bucket name.int
getChunkSizeBytes()
Sets the chunk size in bytes.ReadConcern
getReadConcern()
Get the read concern for the GridFSBucket.ReadPreference
getReadPreference()
Get the read preference for the GridFSBucket.WriteConcern
getWriteConcern()
Get the write concern for the GridFSBucket.Future<java.lang.Void>
rename(ClientSession clientSession, ObjectId id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.void
rename(ClientSession clientSession, ObjectId id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.Future<java.lang.Void>
rename(ClientSession clientSession, java.lang.Object id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.void
rename(ClientSession clientSession, java.lang.Object id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.Future<java.lang.Void>
rename(ObjectId id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.void
rename(ObjectId id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.Future<java.lang.Void>
rename(java.lang.Object id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.void
rename(java.lang.Object id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.Future<ObjectId>
uploadFile(ClientSession clientSession, java.lang.String filename)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadFile(ClientSession clientSession, java.lang.String filename, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.Future<ObjectId>
uploadFile(ClientSession clientSession, java.lang.String filename, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadFile(ClientSession clientSession, java.lang.String filename, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.Future<ObjectId>
uploadFile(java.lang.String filename)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadFile(java.lang.String filename, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.Future<ObjectId>
uploadFile(java.lang.String filename, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadFile(java.lang.String filename, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.Future<ObjectId>
uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.Future<ObjectId>
uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.Future<ObjectId>
uploadStream(java.lang.String filename, ReadStream<Buffer> source)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadStream(java.lang.String filename, ReadStream<Buffer> source, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.Future<ObjectId>
uploadStream(java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
to a GridFS bucket.void
uploadStream(java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
to a GridFS bucket.GridFSBucket
withChunkSizeBytes(int chunkSizeBytes)
Create a new GridFSBucket instance with a new chunk size in bytes.GridFSBucket
withReadConcern(ReadConcern readConcern)
Create a new MongoDatabase instance with a different read concern.GridFSBucket
withReadPreference(ReadPreference readPreference)
Create a new GridFSBucket instance with a different read preference.GridFSBucket
withWriteConcern(WriteConcern writeConcern)
Create a new GridFSBucket instance with a different write concern.
-
-
-
Method Detail
-
create
static GridFSBucket create(MongoDatabase database)
-
create
static GridFSBucket create(MongoDatabase database, java.lang.String bucketName)
-
getBucketName
java.lang.String getBucketName()
The bucket name.- Returns:
- the bucket name
-
getChunkSizeBytes
int getChunkSizeBytes()
Sets the chunk size in bytes. Defaults to 255.- Returns:
- the chunk size in bytes.
-
getWriteConcern
WriteConcern getWriteConcern()
Get the write concern for the GridFSBucket.- Returns:
- the
WriteConcern
-
getReadPreference
ReadPreference getReadPreference()
Get the read preference for the GridFSBucket.- Returns:
- the
ReadPreference
-
getReadConcern
ReadConcern getReadConcern()
Get the read concern for the GridFSBucket.- Returns:
- the
ReadConcern
- Since server release
- 3.2
- MongoDB documentation
- Read Concern
-
withChunkSizeBytes
GridFSBucket withChunkSizeBytes(int chunkSizeBytes)
Create a new GridFSBucket instance with a new chunk size in bytes.- Parameters:
chunkSizeBytes
- the new chunk size in bytes.- Returns:
- a new GridFSBucket instance with the different chunk size in bytes
-
withReadPreference
GridFSBucket withReadPreference(ReadPreference readPreference)
Create a new GridFSBucket instance with a different read preference.- Parameters:
readPreference
- the newReadPreference
for the database- Returns:
- a new GridFSBucket instance with the different readPreference
-
withWriteConcern
GridFSBucket withWriteConcern(WriteConcern writeConcern)
Create a new GridFSBucket instance with a different write concern.- Parameters:
writeConcern
- the newWriteConcern
for the database- Returns:
- a new GridFSBucket instance with the different writeConcern
-
withReadConcern
GridFSBucket withReadConcern(ReadConcern readConcern)
Create a new MongoDatabase instance with a different read concern.- Parameters:
readConcern
- the newReadConcern
for the database- Returns:
- a new GridFSBucket instance with the different ReadConcern
- Since server release
- 3.2
- MongoDB documentation
- Read Concern
-
uploadStream
Future<ObjectId> uploadStream(java.lang.String filename, ReadStream<Buffer> source)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filenamesource
- the stream providing the file data- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
-
uploadStream
void uploadStream(java.lang.String filename, ReadStream<Buffer> source, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filenamesource
- the stream providing the file dataresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
-
uploadFile
Future<ObjectId> uploadFile(java.lang.String filename)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filename providing the file data- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
-
uploadFile
void uploadFile(java.lang.String filename, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filename providing the file dataresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
-
uploadStream
Future<ObjectId> uploadStream(java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filenamesource
- the stream providing the file dataoptions
- the GridFSUploadOptions- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
-
uploadStream
void uploadStream(java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filenamesource
- the stream providing the file dataoptions
- the GridFSUploadOptionsresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
-
uploadFile
Future<ObjectId> uploadFile(java.lang.String filename, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filename providing the file dataoptions
- the GridFSUploadOptions- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
-
uploadFile
void uploadFile(java.lang.String filename, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
filename
- the filename providing the file dataoptions
- the GridFSUploadOptionsresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
-
uploadStream
Future<ObjectId> uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filenamesource
- the stream providing the file data- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
- Since server release
- 3.6
-
uploadStream
void uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filenamesource
- the stream providing the file dataresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
- Since server release
- 3.6
-
uploadFile
Future<ObjectId> uploadFile(ClientSession clientSession, java.lang.String filename)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filename providing the file data- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
- Since server release
- 3.6
-
uploadFile
void uploadFile(ClientSession clientSession, java.lang.String filename, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filename providing the file dataresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
- Since server release
- 3.6
-
uploadStream
Future<ObjectId> uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filenamesource
- the stream providing the file dataoptions
- the GridFSUploadOptions- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
- Since server release
- 3.6
-
uploadStream
void uploadStream(ClientSession clientSession, java.lang.String filename, ReadStream<Buffer> source, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filenamesource
- the stream providing the file dataoptions
- the GridFSUploadOptionsresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
- Since server release
- 3.6
-
uploadFile
Future<ObjectId> uploadFile(ClientSession clientSession, java.lang.String filename, GridFSUploadOptions options)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filename providing the file dataoptions
- the GridFSUploadOptions- Returns:
- a future with a single element, the ObjectId of the uploaded file.
- Since:
- 1.13
- Since server release
- 3.6
-
uploadFile
void uploadFile(ClientSession clientSession, java.lang.String filename, GridFSUploadOptions options, Handler<AsyncResult<ObjectId>> resultHandler)
Uploads the contents of the givenPublisher
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.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the filename providing the file dataoptions
- the GridFSUploadOptionsresultHandler
- an async result with a single element, the ObjectId of the uploaded file.- Since:
- 1.13
- Since server release
- 3.6
-
downloadByObjectId
GridFSDownloadResult downloadByObjectId(ObjectId id)
Downloads the contents of the stored file specified byid
into thePublisher
.- Parameters:
id
- the ObjectId of the file to be written to the destination Publisher- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
-
downloadByObjectId
GridFSDownloadResult downloadByObjectId(ObjectId id, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byid
into thePublisher
.- Parameters:
id
- the ObjectId of the file to be written to the destination PublishercontrolOptions
- options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
-
downloadByFilename
GridFSDownloadResult downloadByFilename(java.lang.String filename)
Downloads the contents of the stored file specified byfilename
into thePublisher
.- Parameters:
filename
- the name of the file to be downloaded- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
-
downloadByFilename
GridFSDownloadResult downloadByFilename(java.lang.String filename, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byfilename
into thePublisher
.- Parameters:
filename
- the name of the file to be downloadedcontrolOptions
- options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
-
downloadByFilename
GridFSDownloadResult downloadByFilename(java.lang.String filename, GridFSDownloadOptions options)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.- Parameters:
filename
- the name of the file to be downloadedoptions
- the download options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
-
downloadByFilename
GridFSDownloadResult downloadByFilename(java.lang.String filename, GridFSDownloadOptions options, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.- Parameters:
filename
- the name of the file to be downloadedoptions
- the download optionscontrolOptions
- options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
-
downloadByObjectId
GridFSDownloadResult downloadByObjectId(ClientSession clientSession, ObjectId id)
Downloads the contents of the stored file specified byid
into thePublisher
.- Parameters:
clientSession
- the client session with which to associate this operationid
- the ObjectId of the file to be written to the destination Publisher- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
- Since server release
- 3.6
-
downloadByObjectId
GridFSDownloadResult downloadByObjectId(ClientSession clientSession, ObjectId id, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byid
into thePublisher
.- Parameters:
clientSession
- the client session with which to associate this operationid
- the ObjectId of the file to be written to the destination PublishercontrolOptions
- options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
- Since server release
- 3.6
-
downloadByFilename
GridFSDownloadResult downloadByFilename(ClientSession clientSession, java.lang.String filename)
Downloads the contents of the latest version of the stored file specified byfilename
into thePublisher
.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the name of the file to be downloaded- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
- Since server release
- 3.6
-
downloadByFilename
GridFSDownloadResult downloadByFilename(ClientSession clientSession, java.lang.String filename, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the latest version of the stored file specified byfilename
into thePublisher
.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the name of the file to be downloadedcontrolOptions
- options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
- Since server release
- 3.6
-
downloadByFilename
GridFSDownloadResult downloadByFilename(ClientSession clientSession, java.lang.String filename, GridFSDownloadOptions options)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the name of the file to be downloadedoptions
- the download options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
- Since server release
- 3.6
-
downloadByFilename
GridFSDownloadResult downloadByFilename(ClientSession clientSession, java.lang.String filename, GridFSDownloadOptions options, GridFSDownloadControlOptions controlOptions)
Downloads the contents of the stored file specified byfilename
and by the revision inoptions
into thePublisher
.- Parameters:
clientSession
- the client session with which to associate this operationfilename
- the name of the file to be downloadedoptions
- the download optionscontrolOptions
- options- Returns:
- a result with a single element, representing the amount of data written
- Since:
- 1.13
- Since server release
- 3.6
-
find
MongoResult<GridFSFile> find()
Finds all documents in the files collection.- Returns:
- the GridFS find result interface
- MongoDB documentation
- Find
-
find
MongoResult<GridFSFile> find(GridFSFindOptions options)
Finds all documents in the files collection.- Parameters:
options
- options- Returns:
- the GridFS find result interface
- MongoDB documentation
- Find
-
find
MongoResult<GridFSFile> find(JsonObject 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"));
- Parameters:
filter
- the query filter- Returns:
- the GridFS find result interface
- See Also:
Filters
-
find
MongoResult<GridFSFile> find(JsonObject filter, GridFSFindOptions options)
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"));
- Parameters:
filter
- the query filteroptions
- options- Returns:
- the GridFS find result interface
- See Also:
Filters
-
find
MongoResult<GridFSFile> find(ClientSession clientSession)
Finds all documents in the files collection.
-
find
MongoResult<GridFSFile> find(ClientSession clientSession, GridFSFindOptions options)
Finds all documents in the files collection.
-
find
MongoResult<GridFSFile> find(ClientSession clientSession, JsonObject 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"));
-
find
MongoResult<GridFSFile> find(ClientSession clientSession, JsonObject filter, GridFSFindOptions options)
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"));
-
delete
Future<java.lang.Void> delete(ObjectId id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
id
- the ObjectId of the file to be deleted- Returns:
- a future with a single element, representing that the file has been deleted
-
delete
void delete(ObjectId id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
id
- the ObjectId of the file to be deletedresultHandler
- an async result with a single element, representing that the file has been deleted
-
delete
Future<java.lang.Void> delete(java.lang.Object id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
id
- the ObjectId of the file to be deleted- Returns:
- a future with a single element, representing that the file has been deleted
-
delete
void delete(java.lang.Object id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
id
- the ObjectId of the file to be deletedresultHandler
- an async result with a single element, representing that the file has been deleted
-
delete
Future<java.lang.Void> delete(ClientSession clientSession, ObjectId id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
clientSession
- the client session with which to associate this operationid
- the ObjectId of the file to be deleted- Returns:
- a future with a single element, representing that the file has been deleted
- Since:
- 1.7
- Since server release
- 3.6
-
delete
void delete(ClientSession clientSession, ObjectId id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
clientSession
- the client session with which to associate this operationid
- the ObjectId of the file to be deletedresultHandler
- an async result with a single element, representing that the file has been deleted- Since:
- 1.7
- Since server release
- 3.6
-
delete
Future<java.lang.Void> delete(ClientSession clientSession, java.lang.Object id)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
clientSession
- the client session with which to associate this operationid
- the ObjectId of the file to be deleted- Returns:
- a future with a single element, representing that the file has been deleted
- Since:
- 1.7
- Since server release
- 3.6
-
delete
void delete(ClientSession clientSession, java.lang.Object id, Handler<AsyncResult<java.lang.Void>> resultHandler)
Given aid
, delete this stored file's files collection document and associated chunks from a GridFS bucket.- Parameters:
clientSession
- the client session with which to associate this operationid
- the ObjectId of the file to be deletedresultHandler
- an async result with a single element, representing that the file has been deleted- Since:
- 1.7
- Since server release
- 3.6
-
rename
Future<java.lang.Void> rename(ObjectId id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.- Parameters:
id
- the id of the file in the files collection to renamenewFilename
- the new filename for the file- Returns:
- a future with a single element, representing that the file has been renamed
-
rename
void rename(ObjectId id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.- Parameters:
id
- the id of the file in the files collection to renamenewFilename
- the new filename for the fileresultHandler
- an async result with a single element, representing that the file has been renamed
-
rename
Future<java.lang.Void> rename(java.lang.Object id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.- Parameters:
id
- the id of the file in the files collection to renamenewFilename
- the new filename for the file- Returns:
- a future with a single element, representing that the file has been renamed
-
rename
void rename(java.lang.Object id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.- Parameters:
id
- the id of the file in the files collection to renamenewFilename
- the new filename for the fileresultHandler
- an async result with a single element, representing that the file has been renamed
-
rename
Future<java.lang.Void> rename(ClientSession clientSession, ObjectId id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.- Parameters:
clientSession
- the client session with which to associate this operationid
- the id of the file in the files collection to renamenewFilename
- the new filename for the file- Returns:
- a future with a single element, representing that the file has been renamed
- Since:
- 1.7
- Since server release
- 3.6
-
rename
void rename(ClientSession clientSession, ObjectId id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.- Parameters:
clientSession
- the client session with which to associate this operationid
- the id of the file in the files collection to renamenewFilename
- the new filename for the fileresultHandler
- an async result with a single element, representing that the file has been renamed- Since:
- 1.7
- Since server release
- 3.6
-
rename
Future<java.lang.Void> rename(ClientSession clientSession, java.lang.Object id, java.lang.String newFilename)
Renames the stored file with the specifiedid
.- Parameters:
clientSession
- the client session with which to associate this operationid
- the id of the file in the files collection to renamenewFilename
- the new filename for the file- Returns:
- a future with a single element, representing that the file has been renamed
- Since:
- 1.7
- Since server release
- 3.6
-
rename
void rename(ClientSession clientSession, java.lang.Object id, java.lang.String newFilename, Handler<AsyncResult<java.lang.Void>> resultHandler)
Renames the stored file with the specifiedid
.- Parameters:
clientSession
- the client session with which to associate this operationid
- the id of the file in the files collection to renamenewFilename
- the new filename for the fileresultHandler
- an async result with a single element, representing that the file has been renamed- Since:
- 1.7
- Since server release
- 3.6
-
drop
Future<java.lang.Void> drop()
Drops the data associated with this bucket from the database.- Returns:
- a future with a single element, representing that the collections have been dropped
-
drop
void drop(Handler<AsyncResult<java.lang.Void>> resultHandler)
Drops the data associated with this bucket from the database.- Parameters:
resultHandler
- an async result with a single element, representing that the collections have been dropped
-
drop
Future<java.lang.Void> drop(ClientSession clientSession)
Drops the data associated with this bucket from the database.- Parameters:
clientSession
- the client session with which to associate this operation- Returns:
- a future with a single element, representing that the collections have been dropped
- Since:
- 1.7
- Since server release
- 3.6
-
drop
void drop(ClientSession clientSession, Handler<AsyncResult<java.lang.Void>> resultHandler)
Drops the data associated with this bucket from the database.- Parameters:
clientSession
- the client session with which to associate this operationresultHandler
- an async result with a single element, representing that the collections have been dropped- Since:
- 1.7
- Since server release
- 3.6
-
-