PYTHON-1789 Update indexing docs for wildcard index options

This commit is contained in:
Bernie Hackett 2019-07-09 14:21:54 -07:00
parent 26d25cd74e
commit 826cc50055
2 changed files with 12 additions and 6 deletions

View File

@ -1931,10 +1931,13 @@ class Collection(common.BaseObject):
this collection after <int> seconds. The indexed field must
be a UTC datetime or the data will not expire.
- `partialFilterExpression`: A document that specifies a filter for
a partial index.
a partial index. Requires server version >=3.2.
- `collation` (optional): An instance of
:class:`~pymongo.collation.Collation`. This option is only supported
on MongoDB 3.4 and above.
- `wildcardProjection`: Allows users to include or exclude specific
field paths from a `wildcard index`_ using the { "$**" : 1} key
pattern. Requires server version >= 4.2.
See the MongoDB documentation for a full list of supported options by
server version.
@ -1943,8 +1946,6 @@ class Collection(common.BaseObject):
option is silently ignored by the server and unique index builds
using the option will fail if a duplicate value is detected.
.. note:: `partialFilterExpression` requires server version **>= 3.2**
.. note:: The :attr:`~pymongo.collection.Collection.write_concern` of
this collection is automatically applied to this operation when using
MongoDB >= 3.4.
@ -1972,6 +1973,8 @@ class Collection(common.BaseObject):
for the drop_dups and bucket_size aliases.
.. mongodoc:: indexes
.. _wildcard index: https://docs.mongodb.com/master/core/index-wildcard/#wildcard-index-core
"""
keys = helpers._index_list(keys)
name = kwargs.setdefault("name", helpers._gen_index_name(keys))

View File

@ -338,15 +338,16 @@ class IndexModel(object):
this collection after <int> seconds. The indexed field must
be a UTC datetime or the data will not expire.
- `partialFilterExpression`: A document that specifies a filter for
a partial index.
a partial index. Requires server version >= 3.2.
- `collation`: An instance of :class:`~pymongo.collation.Collation`
that specifies the collation to use in MongoDB >= 3.4.
- `wildcardProjection`: Allows users to include or exclude specific
field paths from a `wildcard index`_ using the { "$**" : 1} key
pattern. Requires server version >= 4.2.
See the MongoDB documentation for a full list of supported options by
server version.
.. note:: `partialFilterExpression` requires server version **>= 3.2**
:Parameters:
- `keys`: a single key or a list of (key, direction)
pairs specifying the index to create
@ -356,6 +357,8 @@ class IndexModel(object):
.. versionchanged:: 3.2
Added partialFilterExpression to support partial indexes.
.. _wildcard index: https://docs.mongodb.com/master/core/index-wildcard/#wildcard-index-core
"""
keys = _index_list(keys)
if "name" not in kwargs: