Skip to content
Closed
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
9 changes: 9 additions & 0 deletions mongoengine/queryset/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ def __len__(self):

self._len = len(self._result_cache)
return self._len

def exists(self):
"""
Returns a boolean whether the result exists or not
"""
if self.__len__() != 0:
return True
else:
return False

def __iter__(self):
"""Iteration utilises a results cache which iterates the cursor
Expand Down