Add declarative ClientSession support. [DATAMONGO-2093] #2962
Nathaniel Mishkin commented
Is this a task you'd consider accepting implementation work from an outsider for? Is it plausible that someone whose interaction with Spring has primarily been as a consumer of its APIs and a browser of parts of its code base could make effective progress on this task? I.e., is motivation and willingness going to get me anywhere? :)
I see a clear use case for this feature. It's perfectly reasonable to imagine a project starting with a single MongoDB instance (or even a simple, small replica set for disaster recovery or backup) inadvertently baking into their application logic a dependency on the implicit causal consistency provided by the single MongoDB instance. Later there may be a need to "scale out" the application (move read traffic to replicas to scale writes at the master or geographically replicate data so as to avoid long distance requests when reading data) and change the read preference from PRIMARY to NEAREST (a "close" secondary replica) while still maintaining causal consistency guarantees to avoid having to rewrite the application to either a) deal with eventually consistent data or b) employ a more strict transactional approach to data access. In fact, I think this progression is more likely to be more common than starting with or transitioning to using transactions as that's a much newer feature than causal consistency in MongoDB. Also, it seems to me that causal consistency can address a lot of the issues transactions are commonly used for without much of the associated overhead.
I'm glad to see this issue opened as it precludes the need to rewrite with a transactional model. Also, I can't find a TransactionDefinition that maps to the particular guarantees provided by causal consistency