Skip to content

Commit 2acdcfa

Browse files
author
Mike Dirolf
committed
always use a hard limit for explain()
1 parent 82a2ccb commit 2acdcfa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pymongo/cursor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ def explain(self):
253253
"""
254254
c = self.clone()
255255
c.__explain = True
256+
257+
# always use a hard limit for explains
258+
if c.__limit:
259+
c.__limit = -abs(c.__limit)
256260
return c.next()
257261

258262
def __index_name_to_list(self, index_name):

0 commit comments

Comments
 (0)