Quantcast
Viewing all articles
Browse latest Browse all 128

declarative way for setting mongo readprefference/writeconcern

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 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 the writeConcern NONE.

so what I have done for our project (yum-repo-server)

Code:

@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

Viewing all articles
Browse latest Browse all 128

Trending Articles