-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
On PyMongo 2.8.1, a tuple (and maybe other sequences) were allowed as the parameter to the projection. On PyMongo 3, anything but list and dict seems to raise an error:
$ python -c "__import__('pymongo').MongoClient().test.tests.find(filter=('foo',))" $ easy_install -q -U pymongo $ python -c "__import__('pymongo').MongoClient().test.tests.find(filter=('foo',))" Traceback (most recent call last): File "<string>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pymongo-3.0.2-py3.4-macosx-10.6-intel.egg/pymongo/collection.py", line 929, in find return Cursor(self, *args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pymongo-3.0.2-py3.4-macosx-10.6-intel.egg/pymongo/cursor.py", line 119, in __init__ validate_is_mapping("filter", spec) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pymongo-3.0.2-py3.4-macosx-10.6-intel.egg/pymongo/common.py", line 348, in validate_is_mapping "collections.Mapping" % (option,)) TypeError: filter must be an instance of dict, bson.son.SON, or other type that inherits from collections.Mapping
I suggest that the more lenient form be restored including support of any sequence for the projection field names.