Description
Björn Voß opened DATAMONGO-697 and commented
Hi,
I would like to discuss a feature, maybe called "declarative MongoTx", which I need much more than the possibility of calculating a WriteConcern based on a MongoAction, as I think more in usecases greater than on mongo call.
So mongo is eventually consistent and as a user of mongo you know that and are happy with that, but sometimes you might have the need to do some stuff really against the actual data (primary) and as you do critical stuff you want to be 'REPLICA_SAFE' as the other times reading from secondaries is absolute fine as well as the writeConcern NONE.
so what I have done for our project yum-repo-server
@MongoTx(readPreference = "primary", writeConcern = "REPLICAS_SAFE")
public void doMyMissionCriticalStuff() {
...
}
And now I have a similar behavior like @Transactional
with spring-data, regarding the isolation level, but NO rollback or so.
What do you think about my idea and do you have similar needs?
regards
Attachments:
- MongoTx1.patch (21.33 kB)