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