added count/len for ListResult
This commit is contained in:
parent
62219d9648
commit
5ee4b4a5ac
@ -376,6 +376,15 @@ class ListResult(object):
|
|||||||
def rewind(self):
|
def rewind(self):
|
||||||
self._cursor.rewind()
|
self._cursor.rewind()
|
||||||
|
|
||||||
|
def count(self):
|
||||||
|
"""
|
||||||
|
Count the selected elements in the query.
|
||||||
|
"""
|
||||||
|
return self._cursor.count(with_limit_and_skip=True)
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return self.count()
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user