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

Rationalize keys in pymongo/common options

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Context

      While adding suggestions when a user incorrectly passed a kwarg to MongoClient, it highlighted that the keys in the dicts driving validation (eg `pymongo.common.KW_VALIDATORS`) are lowercase, while those in the docstrings are camelCase. It makes sense to rationalize this behavior.

      Definition of done

      Current behavior:

      >>> MongoClient(serverSelectionTimeout=1000)
      ...
      pymongo.errors.ConfigurationError: Unknown option: serverSelectionTimeout. Did you mean one of (serverselectiontimeoutms, server_selector, connecttimeoutms) or maybe a camelCase version of one? Refer to docstring.
      

      The improved error:

      >>> MongoClient(serverSelectionTimeout=1000)
      ...
      pymongo.errors.ConfigurationError: Unknown option: serverSelectionTimeout. Did you mean one of (serverSelectionTimeoutMS, server_selector, connectTimeoutMS) or maybe a camelCase version of one? Refer to docstring.
      

      Pitfalls

      Possibly unexpected test failures or breaking changes in user's code. Want to ensure that changes are backwards-compatible in the sense that kwargs remain case-insensitive.

            Assignee:
            Unassigned Unassigned
            Reporter:
            casey.clements@mongodb.com Casey Clements
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: