added count/len for ListResult

This commit is contained in:
Wilson Júnior 2011-12-16 11:49:20 -02:00
parent 62219d9648
commit 5ee4b4a5ac

View File

@ -376,6 +376,15 @@ class ListResult(object):
def rewind(self):
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):
return self