Interface ReactiveGridFsOperations
- All Known Implementing Classes:
ReactiveGridFsTemplate
public interface ReactiveGridFsOperations
Collection of operations to store and read files from MongoDB GridFS using reactive infrastructure.
- Since:
- 2.2
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionDeletes all files matching the givenQuery
.Flux<com.mongodb.client.gridfs.model.GridFSFile>
Returns aFlux
emitting all files matching the given query.Mono<com.mongodb.client.gridfs.model.GridFSFile>
Returns aMono
emitting the fristGridFSFile
matching the given query orMono.empty()
in case no file matches.Mono<com.mongodb.client.gridfs.model.GridFSFile>
Returns aMono
emitting a singleGridFSFile
matching the given query orMono.empty()
in case no file matches.getResource
(com.mongodb.client.gridfs.model.GridFSFile file) getResource
(String filename) Returns aMono
emitting theReactiveGridFsResource
with the given file name.getResources
(String filenamePattern) Returns aFlux
emitting allReactiveGridFsResource
s matching the given file name pattern.default Mono<org.bson.types.ObjectId>
store
(Publisher<DataBuffer> content, Object metadata) Stores the given content into a file applying the given metadata.default Mono<org.bson.types.ObjectId>
store
(Publisher<DataBuffer> content, String filename) Stores the given content into a file with the given name.default Mono<org.bson.types.ObjectId>
store
(Publisher<DataBuffer> content, String filename, Object metadata) Stores the given content into a file with the given name using the given metadata.default Mono<org.bson.types.ObjectId>
store
(Publisher<DataBuffer> content, String filename, String contentType) Stores the given content into a file with the given name and content type.Mono<org.bson.types.ObjectId>
Stores the given content into a file with the given name and content type using the given metadata.default Mono<org.bson.types.ObjectId>
store
(Publisher<DataBuffer> content, String filename, String contentType, org.bson.Document metadata) Stores the given content into a file with the given name and content type using the given metadata.default Mono<org.bson.types.ObjectId>
store
(Publisher<DataBuffer> content, String filename, org.bson.Document metadata) Stores the given content into a file with the given name using the given metadata.default Mono<org.bson.types.ObjectId>
store
(Publisher<DataBuffer> content, org.bson.Document metadata) Stores the given content into a file applying the given metadata.<T> Mono<T>
store
(GridFsObject<T, Publisher<DataBuffer>> upload)
-
Method Details
-
store
Stores the given content into a file with the given name.- Parameters:
content
- must not be null.filename
- must not be null or empty.- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
default Mono<org.bson.types.ObjectId> store(Publisher<DataBuffer> content, @Nullable Object metadata) Stores the given content into a file applying the given metadata.- Parameters:
content
- must not be null.metadata
- can be null.- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
default Mono<org.bson.types.ObjectId> store(Publisher<DataBuffer> content, @Nullable org.bson.Document metadata) Stores the given content into a file applying the given metadata.- Parameters:
content
- must not be null.metadata
- can be null.- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
default Mono<org.bson.types.ObjectId> store(Publisher<DataBuffer> content, @Nullable String filename, @Nullable String contentType) Stores the given content into a file with the given name and content type.- Parameters:
content
- must not be null.filename
- must not be null or empty.contentType
- can be null.- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
default Mono<org.bson.types.ObjectId> store(Publisher<DataBuffer> content, @Nullable String filename, @Nullable Object metadata) Stores the given content into a file with the given name using the given metadata. The metadata object will be marshalled before writing.- Parameters:
content
- must not be null.filename
- can be null or empty.metadata
- can be null.- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
Mono<org.bson.types.ObjectId> store(Publisher<DataBuffer> content, @Nullable String filename, @Nullable String contentType, @Nullable Object metadata) Stores the given content into a file with the given name and content type using the given metadata. The metadata object will be marshalled before writing.- Parameters:
content
- must not be null.filename
- must not be null or empty.contentType
- can be null.metadata
- can be null- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
default Mono<org.bson.types.ObjectId> store(Publisher<DataBuffer> content, @Nullable String filename, @Nullable org.bson.Document metadata) Stores the given content into a file with the given name using the given metadata.- Parameters:
content
- must not be null.filename
- must not be null or empty.metadata
- can be null.- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
default Mono<org.bson.types.ObjectId> store(Publisher<DataBuffer> content, @Nullable String filename, @Nullable String contentType, @Nullable org.bson.Document metadata) Stores the given content into a file with the given name and content type using the given metadata.- Parameters:
content
- must not be null.filename
- must not be null or empty.contentType
- can be null. If not empty, may override content type within metadata.metadata
- can be null.- Returns:
- a
Mono
emitting theObjectId
of theGridFSFile
just created.
-
store
Stores the givenGridFsObject
, likely aGridFsUpload
, into into a file with givenname
. If theGridFsObject.getFileId()
is set, the file will be stored with that id, otherwise the server auto creates a new id.- Type Parameters:
T
- id type of the underlyingGridFSFile
- Parameters:
upload
- theGridFsObject
(most likely aGridFsUpload
) to be stored.- Returns:
Mono
emitting the id of the stored file which is either an auto created value orGridFsObject.getFileId()
.- Since:
- 3.0
-
find
Returns aFlux
emitting all files matching the given query.
NOTE: CurrentlySort
criteria defined at theQuery
will not be regarded as MongoDB does not support ordering for GridFS file access.- Parameters:
query
- must not be null.- Returns:
Flux.empty()
if no mach found.- See Also:
-
findOne
Returns aMono
emitting a singleGridFSFile
matching the given query orMono.empty()
in case no file matches.
NOTE: If more than one file matches the given query the resultingMono
emits an error. If you want to obtain the first found file usefindFirst(Query)
.- Parameters:
query
- must not be null.- Returns:
Mono.empty()
if not match found.
-
findFirst
Returns aMono
emitting the fristGridFSFile
matching the given query orMono.empty()
in case no file matches.- Parameters:
query
- must not be null.- Returns:
Mono.empty()
if not match found.
-
delete
Deletes all files matching the givenQuery
.- Parameters:
query
- must not be null.- Returns:
- a
Mono
signalling operation completion.
-
getResource
Returns aMono
emitting theReactiveGridFsResource
with the given file name.- Parameters:
filename
- must not be null.- Returns:
Mono.empty()
if no match found.
-
getResource
- Parameters:
file
- must not be null.- Returns:
Mono.empty()
if no match found.
-
getResources
Returns aFlux
emitting allReactiveGridFsResource
s matching the given file name pattern.- Parameters:
filenamePattern
- must not be null.- Returns:
Flux.empty()
if no match found.
-