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

Setting $maxTimeMS raises OperationFailure when connecting through mongos (with ReadPreference.NEAREST)

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 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.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            Thinh Thinh Nguyen [X]
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: