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

Index and user manipulation broken with mongos versions before 2.4.0

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.1, 3.0
    • Affects Version/s: 2.7
    • Component/s: None
    • None

      Trying to create an index against a mongos version before 2.4.0 will result in an error similar to this:

      >>> c.foo.bar.create_index('foo')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "pymongo/collection.py", line 1058, in create_index
          indexes=[index])
        File "pymongo/database.py", line 410, in command
          read_preference, **kwargs)[0]
        File "pymongo/database.py", line 321, in _command
          for doc in cursor:
        File "pymongo/cursor.py", line 988, in next
          if len(self.__data) or self._refresh():
        File "pymongo/cursor.py", line 932, in _refresh
          self.__uuid_subtype))
        File "pymongo/cursor.py", line 875, in __send_message
          self.__compile_re)
        File "pymongo/helpers.py", line 110, in _unpack_response
          error_object)
      pymongo.errors.OperationFailure: database error: unrecognized command: createIndexes
      

      Similarly, trying to create a user against mongos previous to 2.4.0:

      >>> c.foo.add_user("foo", "bar")
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "pymongo/database.py", line 755, in add_user
          read_preference=ReadPreference.PRIMARY)
        File "pymongo/database.py", line 410, in command
          read_preference, **kwargs)[0]
        File "pymongo/database.py", line 321, in _command
          for doc in cursor:
        File "pymongo/cursor.py", line 988, in next
          if len(self.__data) or self._refresh():
        File "pymongo/cursor.py", line 932, in _refresh
          self.__uuid_subtype))
        File "pymongo/cursor.py", line 875, in __send_message
          self.__compile_re)
        File "pymongo/helpers.py", line 110, in _unpack_response
          error_object)
      pymongo.errors.OperationFailure: database error: unrecognized command: usersInfo
      

      Or delete a user...

      >>> c.foo.remove_user("foo")
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "pymongo/database.py", line 807, in remove_user
          writeConcern=self._get_wc_override())
        File "pymongo/database.py", line 437, in command
          uuid_subtype, compile_re, **kwargs)[0]
        File "pymongo/database.py", line 337, in _command
          for doc in cursor:
        File "pymongo/cursor.py", line 1038, in next
          if len(self.__data) or self._refresh():
        File "pymongo/cursor.py", line 982, in _refresh
          self.__uuid_subtype))
        File "pymongo/cursor.py", line 925, in __send_message
          self.__compile_re)
        File "pymongo/helpers.py", line 109, in _unpack_response
          error_object)
      pymongo.errors.OperationFailure: database error: unrecognized command: dropUser
      

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: