-
Type: Improvement
-
Resolution: Unresolved
-
Priority: 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.
- related to
-
PYTHON-3036 Improve error message for unknown MongoClient options
- Closed