MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / explain

Method explain

pymongo/synchronous/cursor.py:736–756  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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:

Callers 15

test_explain_commandMethod · 0.45
test_cursorMethod · 0.45
test_index_filterMethod · 0.45
test_explainMethod · 0.45
test_explain_csotMethod · 0.45
test_hintMethod · 0.45
test_explainMethod · 0.45
callbackMethod · 0.45
test_explain_commandMethod · 0.45

Calls 2

cloneMethod · 0.95
nextFunction · 0.90

Tested by 15

test_explain_commandMethod · 0.36
test_cursorMethod · 0.36
test_index_filterMethod · 0.36
test_explainMethod · 0.36
test_explain_csotMethod · 0.36
test_hintMethod · 0.36
test_explainMethod · 0.36
callbackMethod · 0.36
test_explain_commandMethod · 0.36