-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
When connecting through mongos with read_prefence=ReadPreference.NEAREST, fetching result(s) back from a cursor that has max_time_ms set will raise:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/pypy-2.3.1/site-packages/pymongo/cursor.py", line 968, in __next__ if len(self.__data) or self._refresh(): File "/usr/lib64/pypy-2.3.1/site-packages/pymongo/cursor.py", line 905, in _refresh self.__read_preference)) File "/usr/lib64/pypy-2.3.1/site-packages/pymongo/cursor.py", line 838, in __send_message codec_options=self.__codec_options) File "/usr/lib64/pypy-2.3.1/site-packages/pymongo/helpers.py", line 122, in _unpack_response error_object) OperationFailure: database error: Can't canonicalize query: BadValue unknown top level operator: $query
This actually works fine when the driver is connected directly to mongod (bypassing mongos), or if ReadPreference is not defined.
- duplicates
-
PYTHON-905 find_one with sort and PRIMARY_PREFERRED returning no output
- Closed