public class ReactiveGridFsTemplate extends Object implements ReactiveGridFsOperations
ReactiveGridFsOperations implementation to store content into MongoDB GridFS. Uses by default
DefaultDataBufferFactory to create buffers.| Constructor and Description |
|---|
ReactiveGridFsTemplate(DataBufferFactory dataBufferFactory,
ReactiveMongoDatabaseFactory dbFactory,
MongoConverter converter,
String bucket)
Creates a new
ReactiveGridFsTemplate using the given DataBufferFactory,
ReactiveMongoDatabaseFactory and MongoConverter. |
ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory,
MongoConverter converter)
Creates a new
ReactiveGridFsTemplate using the given ReactiveMongoDatabaseFactory and
MongoConverter. |
ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory,
MongoConverter converter,
String bucket)
Creates a new
ReactiveGridFsTemplate using the given ReactiveMongoDatabaseFactory and
MongoConverter. |
| Modifier and Type | Method and Description |
|---|---|
protected com.mongodb.client.gridfs.model.GridFSUploadOptions |
computeUploadOptionsFor(String contentType,
org.bson.Document metadata)
Compute the
GridFSUploadOptions to be used from the given contentType and metadata
Document. |
reactor.core.publisher.Mono<Void> |
delete(Query query)
Deletes all files matching the given
Query. |
reactor.core.publisher.Flux<com.mongodb.client.gridfs.model.GridFSFile> |
find(Query query)
Returns a
Flux emitting all files matching the given query. |
reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> |
findFirst(Query query)
Returns a
Mono emitting the frist GridFSFile matching the given
query or Mono.empty() in case no file matches. |
reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> |
findOne(Query query)
Returns a
Mono emitting a single GridFSFile matching the given
query or Mono.empty() in case no file matches. |
protected com.mongodb.reactivestreams.client.gridfs.GridFSBucket |
getGridFs() |
protected org.bson.Document |
getMappedQuery(org.bson.Document query) |
reactor.core.publisher.Mono<ReactiveGridFsResource> |
getResource(com.mongodb.client.gridfs.model.GridFSFile file)
|
reactor.core.publisher.Mono<ReactiveGridFsResource> |
getResource(String location)
Returns a
Mono emitting the ReactiveGridFsResource with the given file name. |
reactor.core.publisher.Flux<ReactiveGridFsResource> |
getResources(String locationPattern)
Returns a
Flux emitting all ReactiveGridFsResources matching the given file name pattern. |
protected com.mongodb.reactivestreams.client.gridfs.GridFSFindPublisher |
prepareQuery(Query query) |
reactor.core.publisher.Mono<org.bson.types.ObjectId> |
store(com.mongodb.reactivestreams.client.gridfs.AsyncInputStream 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.
|
reactor.core.publisher.Mono<org.bson.types.ObjectId> |
store(com.mongodb.reactivestreams.client.gridfs.AsyncInputStream 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.
|
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.
|
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.
|
protected org.bson.Document |
toDocument(Object value)
Convert a given value into a
Document. |
public ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory, MongoConverter converter)
ReactiveGridFsTemplate using the given ReactiveMongoDatabaseFactory and
MongoConverter.dbFactory - must not be null.converter - must not be null.public ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory, MongoConverter converter, @Nullable String bucket)
ReactiveGridFsTemplate using the given ReactiveMongoDatabaseFactory and
MongoConverter.dbFactory - must not be null.converter - must not be null.bucket - public ReactiveGridFsTemplate(DataBufferFactory dataBufferFactory, ReactiveMongoDatabaseFactory dbFactory, MongoConverter converter, @Nullable String bucket)
ReactiveGridFsTemplate using the given DataBufferFactory,
ReactiveMongoDatabaseFactory and MongoConverter.dataBufferFactory - must not be null.dbFactory - must not be null.converter - must not be null.bucket - public reactor.core.publisher.Mono<org.bson.types.ObjectId> store(com.mongodb.reactivestreams.client.gridfs.AsyncInputStream content,
@Nullable
String filename,
@Nullable
String contentType,
@Nullable
Object metadata)
ReactiveGridFsOperationsstore in interface ReactiveGridFsOperationscontent - must not be null.filename - must not be null or empty.contentType - can be null.metadata - can be nullMono emitting the ObjectId of the GridFSFile just
created.public reactor.core.publisher.Mono<org.bson.types.ObjectId> store(org.reactivestreams.Publisher<DataBuffer> content, @Nullable String filename, @Nullable String contentType, @Nullable Object metadata)
ReactiveGridFsOperationsstore in interface ReactiveGridFsOperationscontent - must not be null.filename - must not be null or empty.contentType - can be null.metadata - can be nullMono emitting the ObjectId of the GridFSFile just
created.public reactor.core.publisher.Mono<org.bson.types.ObjectId> store(com.mongodb.reactivestreams.client.gridfs.AsyncInputStream content,
@Nullable
String filename,
@Nullable
String contentType,
@Nullable
org.bson.Document metadata)
ReactiveGridFsOperationsstore in interface ReactiveGridFsOperationscontent - must not be null.filename - must not be null or empty.contentType - can be null.metadata - can be null.Mono emitting the ObjectId of the GridFSFile just
created.public 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)
ReactiveGridFsOperationsstore in interface ReactiveGridFsOperationscontent - must not be null.filename - must not be null or empty.contentType - can be null.metadata - can be null.Mono emitting the ObjectId of the GridFSFile just
created.public reactor.core.publisher.Flux<com.mongodb.client.gridfs.model.GridFSFile> find(Query query)
ReactiveGridFsOperationsFlux emitting all files matching the given query. Sort criteria defined at the Query will not be regarded as MongoDB
does not support ordering for GridFS file access.find in interface ReactiveGridFsOperationsquery - must not be null.Flux.empty() if no mach found.public reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> findOne(Query query)
ReactiveGridFsOperationsMono emitting a single GridFSFile matching the given
query or Mono.empty() in case no file matches. Mono emits an error. If
you want to obtain the first found file use ReactiveGridFsOperations.findFirst(Query).findOne in interface ReactiveGridFsOperationsquery - must not be null.Mono.empty() if not match found.public reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> findFirst(Query query)
ReactiveGridFsOperationsMono emitting the frist GridFSFile matching the given
query or Mono.empty() in case no file matches.findFirst in interface ReactiveGridFsOperationsquery - must not be null.Mono.empty() if not match found.public reactor.core.publisher.Mono<Void> delete(Query query)
ReactiveGridFsOperationsQuery.delete in interface ReactiveGridFsOperationsquery - must not be null.Mono signalling operation completion.public reactor.core.publisher.Mono<ReactiveGridFsResource> getResource(String location)
ReactiveGridFsOperationsMono emitting the ReactiveGridFsResource with the given file name.getResource in interface ReactiveGridFsOperationslocation - must not be null.Mono.empty() if no match found.public reactor.core.publisher.Mono<ReactiveGridFsResource> getResource(com.mongodb.client.gridfs.model.GridFSFile file)
ReactiveGridFsOperationsgetResource in interface ReactiveGridFsOperationsfile - must not be null.Mono.empty() if no match found.public reactor.core.publisher.Flux<ReactiveGridFsResource> getResources(String locationPattern)
ReactiveGridFsOperationsFlux emitting all ReactiveGridFsResources matching the given file name pattern.getResources in interface ReactiveGridFsOperationslocationPattern - must not be null.Flux.empty() if no match found.protected com.mongodb.reactivestreams.client.gridfs.GridFSFindPublisher prepareQuery(Query query)
protected com.mongodb.reactivestreams.client.gridfs.GridFSBucket getGridFs()
protected org.bson.Document getMappedQuery(org.bson.Document query)
query - pass the given query though a QueryMapper to apply type conversion.protected com.mongodb.client.gridfs.model.GridFSUploadOptions computeUploadOptionsFor(@Nullable String contentType, @Nullable org.bson.Document metadata)
GridFSUploadOptions to be used from the given contentType and metadata
Document.contentType - can be null.metadata - can be nullCopyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.