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 following mongodb reactive repository
@Repository
interface MyRepository : ReactiveMongoRepository<X, String>, ... {
}
The problem is that after the save()
method is executed there is no changed in the object. I managed to fix the problem with save().block()
but I don't know why the first save on the other repository works and this one isn't. Why is this block()
required?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…