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
- is depended on by
-
DRIVERS-149 Some MongoDB 2.6 driver releases may not be able to add users or create indexes with mongos versions before 2.4.0
-
- Closed
-