-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.3.0
-
Component/s: API
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
DBApiLayer.doGetCollection(…) looks up DBCollection items from a cache based on name. However, DBCollection exposes methods to mutate the state of the returned instance which makes those state changes propagate to other (potentially concurrent) clients requesting a collection.
In practice that means that a client e.g. setting a read preference on the collection, is setting it globally for all other clients that want to work with the same collection, although they might want to use a different read preference.
The client side workaround is effectively synchronizing the access to a collection and making sure all mutable properties are always set.
The original issue popped up with Spring Data MongoDB users that wanted to use different read preferences with different MongoTemplate instance.