Returns an explain plan record for this cursor. .. note:: This method uses the default verbosity mode of the `explain command `_, ``allPlansExecution``. To use a different verbosity use :meth
(self)
| 736 | return self |
| 737 | |
| 738 | async def explain(self) -> _DocumentType: |
| 739 | """Returns an explain plan record for this cursor. |
| 740 | |
| 741 | .. note:: This method uses the default verbosity mode of the |
| 742 | `explain command |
| 743 | <https://mongodb.com/docs/manual/reference/command/explain/>`_, |
| 744 | ``allPlansExecution``. To use a different verbosity use |
| 745 | :meth:`~pymongo.asynchronous.database.AsyncDatabase.command` to run the explain |
| 746 | command directly. |
| 747 | |
| 748 | .. note:: The timeout of this method can be set using :func:`pymongo.timeout`. |
| 749 | |
| 750 | .. seealso:: The MongoDB documentation on `explain <https://dochub.mongodb.org/core/explain>`_. |
| 751 | """ |
| 752 | c = self.clone() |
| 753 | c._explain = True |
| 754 | |
| 755 | # always use a hard limit for explains |
| 756 | if c._limit: |
| 757 | c._limit = -abs(c._limit) |
| 758 | return await anext(c) |
| 759 | |
| 760 | def _set_hint(self, index: Optional[_Hint]) -> None: |
| 761 | if index is None: |