Details
-
New Feature
-
Status: Backlog
-
Unknown
-
Resolution: Unresolved
-
None
-
None
-
None
Description
>>> client.t.t.find(hint={'x': 1}) |
Traceback (most recent call last):
|
File "<stdin>", line 1, in <module> |
File "/Users/shane/git/mongo-python-driver/pymongo/collection.py", line 1381, in find |
return Cursor(self, *args, **kwargs) |
File "/Users/shane/git/mongo-python-driver/pymongo/cursor.py", line 220, in __init__ |
self.__set_hint(hint) |
File "/Users/shane/git/mongo-python-driver/pymongo/cursor.py", line 860, in __set_hint |
self.__hint = helpers._index_document(index) |
File "/Users/shane/git/mongo-python-driver/pymongo/helpers.py", line 86, in _index_document |
raise TypeError("passing a dict to sort/create_index/hint is not " |
TypeError: passing a dict to sort/create_index/hint is not allowed - use a list of tuples instead. did you mean [('x', 1)]? |
Now that we've dropped support for Python <=3.5 (PYTHON-2386) we should allow passing dict to sort/create_index/hint. Dicts are always ordered by insertion order in 3.6+.
Attachments
Issue Links
- depends on
-
PYTHON-2386 Drop Python 3.5 support
-
- Closed
-
- is related to
-
PYTHON-2884 Use dict instead of SON for internal command construction
-
- Scheduled
-