Hi ,
I have been trying to move from Mongo-DB async driver to Java reactive driver.
so far I have been successful in migrating most of the operations.
But I’m stuck with MongoDbIterable and trying to find a compatible version for reactive driver
Here is the code snippet for async driver
String param = "hello";
database. getCollection("sample").find(Filters.eq("mongo", param)).forEach(
new Block<T>() {
@Override
public void apply(ProcessingProtectedRegion region) {
//my code to handle
}
},
//implementation of SingleResultCallback<T>
);
Im trying to migrate the above snippet to Reactive driver but not able to find the correct operation which would behave similar to the ForEach() of async driver that takes 2 parameter as it react driver operations always needs subscriber
documentation of Async driver ForEach opperation
/* Iterates over all documents in the view, applying the given block to each, and completing the returned future after all documents
* have been iterated, or an exception has occurred.
* @param block the block to apply to each document
* @param callback a callback that completed once the iteration has completed
*/
void forEach(Block<? super TResult> block, SingleResultCallback<Void> callback)