Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2164

Rethink MongoClient read only configuration attributes

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Major Change

      MongoClient has a large-ish number of read only attributes, some with values that were defined at creation time, some that provide information about the connected topology. The MongoClient configuration attributes (max_pool_size, min_pool_size, max_idle_time_ms, local_threshold_ms, server_selection_timeout, etc.) only represent a small number of the possible URI options. The attributes that expose limits of a connected server (max_bson_size, max_message_size, max_write_batch_size, etc.) are potentially misleading since they can vary from mongod instance to instance in a mixed version replica set, and may not represent the limits of the shards behind a connected mongos. They are a vestige of prehistoric versions of MongoClient (called Connection back then) that only connected to a single mongod.

      Let's rethink all of this for PyMongo 4.0. If we want to expose the values used to configure the MongoClient instance, we can just expose them all in one attribute (sans read_concern, read_preference and write_concern which have to remain). For topology information we should probably just deprecate and delete the attributes, adding documentation and examples for how to access the information for each topology member.

            shane.harvey@mongodb.com Shane Harvey
            bernie@mongodb.com Bernie Hackett
            0 Vote for this issue
            3 Start watching this issue