Reactive Spring Data Mongo Merge Operation

111 Views Asked by At

I want to write to MongoDB with Spring Integration and Project Reactor. My needed command is a merge operation, so I started that with the following snippet:

MergeOperation mergeOperation = Aggregation.merge()
        .intoCollection("someCollection")
        .on("_id")
        .whenMatched(MergeOperation.WhenDocumentsMatch.mergeDocuments())
        .whenNotMatched(MergeOperation.WhenDocumentsDontMatch.discardDocument())
        .build();

@Bean
public IntegrationFlow dataPipeline() {
   return IntegrationFlows.from(somePublisher)
//      .handle(-----) - MergeOperation usage syntax
      .get();
}

I would like to know what is the recommended way of using the merge command with Reactive Spring Data Mongo, and if its supported and possible with reactive streams. Since I've seen that there's a dedicated class for reactive aggregations, I wonder if the absent of reactive merge operation class means no support for the merge operation with reactive streams. If it is possible, I'd like to get some help with the syntax

0

There are 0 best solutions below