We should deprecate all of the non-const methods on mongocxx::client, namely:
- client::read_concern(class read_concern)
- client::read_preference(class read_preference)
- client::write_concern(class write_concern)
This would allow us to eventually remove the calls to mongoc_client_set_read_concern() and others from client.cpp, which in turn would allow the C++ driver to be in compliance with the C driver requirement of "It is a programming error to call this function on a client from a mongoc_client_pool_t.".
We should document that users should instead set these values on the client/pool URI, or the database or collection objects derived from the client instead.
Because clients have mutable state, it may be possible for the following to happen:
- check out client A from pool
- modify client A's write concern from default set via URI
- perform operations with modified write concern (e.g. find-and-modify ops)
- return client A to pool
- check out client A from pool, still with modified write concern
- perform operations with modified write concern rather than the default
Is this actually possible? If so, should we enforce an invariant that all clients are checked out with identical configuration? Should we push that invariant upstream to libmongoc?