Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1086

Deprecate non-const methods on mongocxx::client

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.0-rc0
    • Affects Version/s: None
    • Component/s: Documentation
    • None

      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.

      Original description:

      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?

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            david.golden@mongodb.com David Golden
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: