Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
Development
===========
- (Fill this out as you fix issues and develop your features).
- BREAKING CHANGE: Removed the deprecated `format` param from `QuerySet.explain` #2113
- BREAKING CHANGE: Renamed `MongoEngineConnectionError` to `ConnectionFailure` #2111
- If you catch/use `MongoEngineConnectionError` in your code, you'll have to rename it.
- BREAKING CHANGE: Positional arguments when instantiating a document are no longer supported. #2103
Expand Down
19 changes: 2 additions & 17 deletions mongoengine/queryset/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import copy
import itertools
import pprint
import re
import warnings

Expand Down Expand Up @@ -1109,25 +1108,11 @@ def comment(self, text):
"""
return self._chainable_method("comment", text)

def explain(self, format=False):
def explain(self):
"""Return an explain plan record for the
:class:`~mongoengine.queryset.QuerySet`\ 's cursor.

:param format: format the plan before returning it
"""
plan = self._cursor.explain()

# TODO remove this option completely - it's useless. If somebody
# wants to pretty-print the output, they easily can.
if format:
msg = (
'"format" param of BaseQuerySet.explain has been '
"deprecated and will be removed in future versions."
)
warnings.warn(msg, DeprecationWarning)
plan = pprint.pformat(plan)

return plan
return self._cursor.explain()

# DEPRECATED. Has no more impact on PyMongo 3+
def snapshot(self, enabled):
Expand Down