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 aFlux
emitting all files matching the given query.reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile>
Returns aMono
emitting the fristGridFSFile
matching the given query orMono.empty()
in case no file matches.reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile>
Returns aMono
emitting a singleGridFSFile
matching 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 aMono
emitting theReactiveGridFsResource
with the given file name.reactor.core.publisher.Flux<ReactiveGridFsResource>
getResources
(String filenamePattern) Returns aFlux
emitting allReactiveGridFsResource
s 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
Mono
emitting theObjectId
of theGridFSFile
just 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
Mono
emitting theObjectId
of theGridFSFile
just 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
Mono
emitting theObjectId
of theGridFSFile
just 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
Mono
emitting theObjectId
of theGridFSFile
just 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
Mono
emitting theObjectId
of theGridFSFile
just 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
Mono
emitting theObjectId
of theGridFSFile
just 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
Mono
emitting theObjectId
of theGridFSFile
just 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
Mono
emitting theObjectId
of theGridFSFile
just 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:
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
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 aFlux
emitting allReactiveGridFsResource
s matching the given file name pattern.- Parameters:
filenamePattern
- must not be null.- Returns:
Flux.empty()
if no match found.
-