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 Details

    • store

      default Mono<org.bson.types.ObjectId> store(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 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile 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 the ObjectId of the GridFSFile just created.
    • store

      <T> Mono<T> store(GridFsObject<T,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

      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

      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

      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

      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

      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

      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

      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.