@@ -1985,8 +1985,9 @@ def create_index(self, keys, session=None, **kwargs):
1985
1985
1986
1986
- `name`: custom name to use for this index - if none is
1987
1987
given, a name will be generated.
1988
- - `unique`: if ``True`` creates a uniqueness constraint on the index.
1989
- - `background`: if ``True`` this index should be created in the
1988
+ - `unique`: if ``True``, creates a uniqueness constraint on the
1989
+ index.
1990
+ - `background`: if ``True``, this index should be created in the
1990
1991
background.
1991
1992
- `sparse`: if ``True``, omit from the index any documents that lack
1992
1993
the indexed field.
@@ -2002,13 +2003,15 @@ def create_index(self, keys, session=None, **kwargs):
2002
2003
this collection after <int> seconds. The indexed field must
2003
2004
be a UTC datetime or the data will not expire.
2004
2005
- `partialFilterExpression`: A document that specifies a filter for
2005
- a partial index. Requires server version >=3.2.
2006
+ a partial index. Requires MongoDB >=3.2.
2006
2007
- `collation` (optional): An instance of
2007
- :class:`~pymongo.collation.Collation`. This option is only supported
2008
- on MongoDB 3.4 and above.
2008
+ :class:`~pymongo.collation.Collation`. Requires MongoDB >= 3.4.
2009
2009
- `wildcardProjection`: Allows users to include or exclude specific
2010
- field paths from a `wildcard index`_ using the { "$**" : 1} key
2011
- pattern. Requires server version >= 4.2.
2010
+ field paths from a `wildcard index`_ using the {"$**" : 1} key
2011
+ pattern. Requires MongoDB >= 4.2.
2012
+ - `hidden`: if ``True``, this index will be hidden from the query
2013
+ planner and will not be evaluated as part of query plan
2014
+ selection. Requires MongoDB >= 4.4.
2012
2015
2013
2016
See the MongoDB documentation for a full list of supported options by
2014
2017
server version.
@@ -2030,18 +2033,20 @@ def create_index(self, keys, session=None, **kwargs):
2030
2033
options (see the above list) should be passed as keyword
2031
2034
arguments
2032
2035
2036
+ .. versionchanged:: 3.11
2037
+ Added the ``hidden`` option.
2033
2038
.. versionchanged:: 3.6
2034
2039
Added ``session`` parameter. Added support for passing maxTimeMS
2035
2040
in kwargs.
2036
2041
.. versionchanged:: 3.4
2037
2042
Apply this collection's write concern automatically to this operation
2038
2043
when connected to MongoDB >= 3.4. Support the `collation` option.
2039
2044
.. versionchanged:: 3.2
2040
- Added partialFilterExpression to support partial indexes.
2045
+ Added partialFilterExpression to support partial indexes.
2041
2046
.. versionchanged:: 3.0
2042
- Renamed `key_or_list` to `keys`. Removed the `cache_for` option.
2043
- :meth:`create_index` no longer caches index names. Removed support
2044
- for the drop_dups and bucket_size aliases.
2047
+ Renamed `key_or_list` to `keys`. Removed the `cache_for` option.
2048
+ :meth:`create_index` no longer caches index names. Removed support
2049
+ for the drop_dups and bucket_size aliases.
2045
2050
2046
2051
.. mongodoc:: indexes
2047
2052
0 commit comments