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 Type
    Method
    Description
    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>
    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.
    reactor.core.publisher.Mono<ReactiveGridFsResource>
    getResource(com.mongodb.client.gridfs.model.GridFSFile file)
    Returns a Mono emitting the ReactiveGridFsResource for a GridFSFile.
    reactor.core.publisher.Mono<ReactiveGridFsResource>
    getResource(String filename)
    Returns a Mono emitting the ReactiveGridFsResource with the given file name.
    reactor.core.publisher.Flux<ReactiveGridFsResource>
    getResources(String filenamePattern)
    Returns a Flux emitting all ReactiveGridFsResources 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)
    Stores the given GridFsObject, likely a GridFsUpload, into into a file with given name.
  • 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile just created.
    • store

      <T> reactor.core.publisher.Mono<T> store(GridFsObject<T,org.reactivestreams.Publisher<DataBuffer>> upload)
      Stores the given GridFsObject, likely a GridFsUpload, into into a file with given name. If the GridFsObject.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 underlying GridFSFile
      Parameters:
      upload - the GridFsObject (most likely a GridFsUpload) to be stored.
      Returns:
      Mono emitting the id of the stored file which is either an auto created value or GridFsObject.getFileId().
      Since:
      3.0
    • find

      reactor.core.publisher.Flux<com.mongodb.client.gridfs.model.GridFSFile> find(Query query)
      Returns a Flux emitting all files matching the given query.
      NOTE: Currently Sort criteria defined at the Query 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

      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.
      NOTE: If more than one file matches the given query the resulting Mono emits an error. If you want to obtain the first found file use findFirst(Query).
      Parameters:
      query - must not be null.
      Returns:
      Mono.empty() if not match found.
    • findFirst

      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.
      Parameters:
      query - must not be null.
      Returns:
      Mono.empty() if not match found.
    • delete

      reactor.core.publisher.Mono<Void> delete(Query query)
      Deletes all files matching the given Query.
      Parameters:
      query - must not be null.
      Returns:
      a Mono signalling operation completion.
    • getResource

      reactor.core.publisher.Mono<ReactiveGridFsResource> getResource(String filename)
      Returns a Mono emitting the ReactiveGridFsResource 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)
      Returns a Mono emitting the ReactiveGridFsResource for a GridFSFile.
      Parameters:
      file - must not be null.
      Returns:
      Mono.empty() if no match found.
    • getResources

      reactor.core.publisher.Flux<ReactiveGridFsResource> getResources(String filenamePattern)
      Returns a Flux emitting all ReactiveGridFsResources matching the given file name pattern.
      Parameters:
      filenamePattern - must not be null.
      Returns:
      Flux.empty() if no match found.