Skip to content

Commit 2d102e7

Browse files
author
Mike Dirolf
committed
minor: doc
1 parent e118e13 commit 2d102e7

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

pymongo/collection.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@ def create_index(self, key_or_list, unique=False, ttl=300, name=None):
522522
- `name` (optional): name for the index. If none given, a name
523523
will be generated.
524524
525+
.. versionadded:: 1.4+
526+
The `name` parameter.
527+
525528
.. seealso:: :meth:`ensure_index`
526529
527530
.. _compound index: http://www.mongodb.org/display/DOCS/Indexes#Indexes-CompoundKeysIndexes
@@ -582,6 +585,9 @@ def ensure_index(self, key_or_list, unique=False, ttl=300, name=None):
582585
- `name` (optional): name for the index. If none given, a name
583586
will be generated.
584587
588+
.. versionadded:: 1.4+
589+
The `name` parameter.
590+
585591
.. seealso:: :meth:`create_index`
586592
"""
587593
if not isinstance(key_or_list, (str, unicode, list)):
@@ -608,12 +614,16 @@ def drop_indexes(self):
608614
def drop_index(self, index_or_name):
609615
"""Drops the specified index on this collection.
610616
611-
Can be used on non-existant collections or collections with no indexes.
612-
Raises OperationFailure on an error. `index_or_name` can be either an
613-
index name (as returned by `create_index`), or an index specifier (as
614-
passed to `create_index`). An index specifier should be a list of (key,
615-
direction) pairs. Raises TypeError if index is not an instance of (str,
616-
unicode, list).
617+
Can be used on non-existant collections or collections with no
618+
indexes. Raises OperationFailure on an error. `index_or_name`
619+
can be either an index name (as returned by `create_index`),
620+
or an index specifier (as passed to `create_index`). An index
621+
specifier should be a list of (key, direction) pairs. Raises
622+
TypeError if index is not an instance of (str, unicode, list).
623+
624+
.. warning:: if a custom name was used on index creation (by
625+
passing the `name` parameter to :meth:`create_index` or
626+
:meth:`ensure_index`) the index **must** be dropped by name.
617627
618628
:Parameters:
619629
- `index_or_name`: index (or name of index) to drop

0 commit comments

Comments
 (0)