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

Deprecate non-const methods on mongocxx::client

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.0-rc0
    • Component/s: Documentation
    • Labels:
      None
    • Story Points:
      0.5
    • Sprint:
      Perl/CXX 2017-05-05

      Description

      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?

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: