@@ -942,9 +942,10 @@ def create_index(self, key_or_list, cache_for=300, **kwargs):
942
942
943
943
Takes either a single key or a list of (key, direction) pairs.
944
944
The key(s) must be an instance of :class:`basestring`
945
- (:class:`str` in python 3), and the directions must be one of
945
+ (:class:`str` in python 3), and the direction(s) must be one of
946
946
(:data:`~pymongo.ASCENDING`, :data:`~pymongo.DESCENDING`,
947
- :data:`~pymongo.GEO2D`). Returns the name of the created index.
947
+ :data:`~pymongo.GEO2D`, :data:`~pymongo.GEOHAYSTACK`,
948
+ :data:`~pymongo.GEOSPHERE`, :data:`~pymongo.HASHED`).
948
949
949
950
To create a single key index on the key ``'mike'`` we just use
950
951
a string argument:
@@ -1058,8 +1059,9 @@ def ensure_index(self, key_or_list, cache_for=300, **kwargs):
1058
1059
The key(s) must be an instance of :class:`basestring`
1059
1060
(:class:`str` in python 3), and the direction(s) must be one of
1060
1061
(:data:`~pymongo.ASCENDING`, :data:`~pymongo.DESCENDING`,
1061
- :data:`~pymongo.GEO2D`). See :meth:`create_index` for a detailed
1062
- example.
1062
+ :data:`~pymongo.GEO2D`, :data:`~pymongo.GEOHAYSTACK`,
1063
+ :data:`~pymongo.GEOSPHERE`, :data:`~pymongo.HASHED`).
1064
+ See :meth:`create_index` for a detailed example.
1063
1065
1064
1066
Unlike :meth:`create_index`, which attempts to create an index
1065
1067
unconditionally, :meth:`ensure_index` takes advantage of some
@@ -1076,8 +1078,9 @@ def ensure_index(self, key_or_list, cache_for=300, **kwargs):
1076
1078
:meth:`ensure_index` within the cache window will fail to
1077
1079
re-create the missing index.
1078
1080
1079
- Returns the name of the created index if an index is actually
1080
- created. Returns ``None`` if the index already exists.
1081
+ Returns the specified or generated index name used if
1082
+ :meth:`ensure_index` attempts to create the index. Returns
1083
+ ``None`` if the index is already cached.
1081
1084
1082
1085
All optional index creation parameters should be passed as
1083
1086
keyword arguments to this method. Valid options include:
0 commit comments