Drops all indexes on this collection. Can be used on non-existent collections or collections with no indexes. Raises OperationFailure on an error. :param session: a :class:`~pymongo.client_session.ClientSession`. :param comment: A user-provided comment t
(
self,
session: Optional[ClientSession] = None,
comment: Optional[Any] = None,
**kwargs: Any,
)
| 2391 | return (self._create_indexes([index], session, **cmd_options))[0] |
| 2392 | |
| 2393 | def drop_indexes( |
| 2394 | self, |
| 2395 | session: Optional[ClientSession] = None, |
| 2396 | comment: Optional[Any] = None, |
| 2397 | **kwargs: Any, |
| 2398 | ) -> None: |
| 2399 | """Drops all indexes on this collection. |
| 2400 | |
| 2401 | Can be used on non-existent collections or collections with no indexes. |
| 2402 | Raises OperationFailure on an error. |
| 2403 | |
| 2404 | :param session: a |
| 2405 | :class:`~pymongo.client_session.ClientSession`. |
| 2406 | :param comment: A user-provided comment to attach to this |
| 2407 | command. |
| 2408 | :param kwargs: optional arguments to the createIndexes |
| 2409 | command (like maxTimeMS) can be passed as keyword arguments. |
| 2410 | |
| 2411 | .. note:: The :attr:`~pymongo.collection.Collection.write_concern` of |
| 2412 | this collection is automatically applied to this operation. |
| 2413 | |
| 2414 | .. versionchanged:: 3.6 |
| 2415 | Added ``session`` parameter. Added support for arbitrary keyword |
| 2416 | arguments. |
| 2417 | |
| 2418 | .. versionchanged:: 3.4 |
| 2419 | Apply this collection's write concern automatically to this operation |
| 2420 | when connected to MongoDB >= 3.4. |
| 2421 | """ |
| 2422 | if comment is not None: |
| 2423 | kwargs["comment"] = comment |
| 2424 | self._drop_index("*", session=session, **kwargs) |
| 2425 | |
| 2426 | def drop_index( |
| 2427 | self, |