Reset cursor object after .count()
This change fixes incorrect result of .only() method of QuerySet instance after using .count().
This commit is contained in:
parent
72ebaa52e9
commit
3194a37fcb
@ -396,7 +396,9 @@ class BaseQuerySet(object):
|
||||
"""
|
||||
if self._limit == 0 and with_limit_and_skip is False or self._none:
|
||||
return 0
|
||||
return self._cursor.count(with_limit_and_skip=with_limit_and_skip)
|
||||
count = self._cursor.count(with_limit_and_skip=with_limit_and_skip)
|
||||
self._cursor_obj = None
|
||||
return count
|
||||
|
||||
def delete(self, write_concern=None, _from_doc_delete=False,
|
||||
cascade_refs=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user