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 TypeMethodDescriptionreactor.core.publisher.Mono<Void>Deletes all files matching the givenQuery.reactor.core.publisher.Flux<com.mongodb.client.gridfs.model.GridFSFile>Returns aFluxemitting all files matching the given query.reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile>Returns aMonoemitting the fristGridFSFilematching the given query orMono.empty()in case no file matches.reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile>Returns aMonoemitting a singleGridFSFilematching the given query orMono.empty()in case no file matches.reactor.core.publisher.Mono<ReactiveGridFsResource>getResource(com.mongodb.client.gridfs.model.GridFSFile file) reactor.core.publisher.Mono<ReactiveGridFsResource>getResource(String filename) Returns aMonoemitting theReactiveGridFsResourcewith the given file name.reactor.core.publisher.Flux<ReactiveGridFsResource>getResources(String filenamePattern) Returns aFluxemitting allReactiveGridFsResources matching the given file name pattern.default reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.Publisher<DataBuffer> content, Object metadata) Stores the given content into a file applying the given metadata.default reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.Publisher<DataBuffer> content, String filename) Stores the given content into a file with the given name.default reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.Publisher<DataBuffer> content, String filename, Object metadata) Stores the given content into a file with the given name using the given metadata.default reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.Publisher<DataBuffer> content, String filename, String contentType) Stores the given content into a file with the given name and content type.reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.Publisher<DataBuffer> content, String filename, String contentType, Object metadata) Stores the given content into a file with the given name and content type using the given metadata.default reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.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 reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.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 reactor.core.publisher.Mono<org.bson.types.ObjectId>store(org.reactivestreams.Publisher<DataBuffer> content, org.bson.Document metadata) Stores the given content into a file applying the given metadata.<T> reactor.core.publisher.Mono<T>store(GridFsObject<T, org.reactivestreams.Publisher<DataBuffer>> upload)
-
Method Details
-
store
default reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.Publisher<DataBuffer> content, String filename) 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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
default reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
default reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
default reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
default reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
default reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
default reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.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
Monoemitting theObjectIdof theGridFSFilejust created.
-
store
<T> reactor.core.publisher.Mono<T> store(GridFsObject<T, org.reactivestreams.Publisher<DataBuffer>> upload) 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:
Monoemitting the id of the stored file which is either an auto created value orGridFsObject.getFileId().- Since:
- 3.0
-
find
Returns aFluxemitting all files matching the given query.
NOTE: CurrentlySortcriteria defined at theQuerywill 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 aMonoemitting a singleGridFSFilematching the given query orMono.empty()in case no file matches.
NOTE: If more than one file matches the given query the resultingMonoemits 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 aMonoemitting the fristGridFSFilematching 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
Monosignalling operation completion.
-
getResource
Returns aMonoemitting theReactiveGridFsResourcewith the given file name.- Parameters:
filename- must not be null.- Returns:
Mono.empty()if no match found.
-
getResource
reactor.core.publisher.Mono<ReactiveGridFsResource> getResource(com.mongodb.client.gridfs.model.GridFSFile file) - Parameters:
file- must not be null.- Returns:
Mono.empty()if no match found.
-
getResources
Returns aFluxemitting allReactiveGridFsResources matching the given file name pattern.- Parameters:
filenamePattern- must not be null.- Returns:
Flux.empty()if no match found.
-