I have the following request handler
fun x(req: ServerRequest) = req.toMono()
.flatMap {
...
val oldest = myRepository.findOldest(...) // this is the object I want to modify
...
val v= anotherMongoReactiveRepository.save(Y(...)) // this saves successfully
myRepository.save(oldest.copy(
remaining = (oldest.remaining - 1)
)) // this is not saved
ok().body(...)
}
and the next mongodb reactive repository
@Repository
interface MyRepository : ReactiveMongoRepository<X, String>, ... {
}
The problem is that after the method is executed, the save()object does not change. I managed to solve the problem with save().block(), but I donโt know why the first save to another repository works, but itโs not. Why is it required block()?
source
share