-
Type: Bug
-
Resolution: Done
-
Priority: Trivial - P5
-
Affects Version/s: None
-
Component/s: None
-
None
Documentation states that ensure_index returns None if index already exists:
Returns the name of the created index if an index is actually
created. Returns ``None`` if the index already exists.
In fact, it returns None only if index creation is cached, by pymongo itself. If it isn't cached but index already exists, it does not create it again, but still return name, not None:
if not self.__database.connection._cached(self.__database.name, self.__name, name): return self.create_index(key_or_list, cache_for, **kwargs) return None
(create_index never returns None, according to documentation).