Skip to content

Commit

Permalink
Merge pull request #62 from coshx/master
Browse files Browse the repository at this point in the history
Adds a default limit for find_all when not specified
  • Loading branch information
heynemann committed May 13, 2014
2 parents 55dbf50 + 49f4ffa commit dc5d873
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions motorengine/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from motorengine.connection import get_connection
from motorengine.errors import UniqueKeyViolationError

DEFAULT_LIMIT = 1000

class QuerySet(object):
def __init__(self, klass):
Expand Down Expand Up @@ -488,6 +489,8 @@ def handle_all_users(result):

if self._limit is not None:
to_list_arguments['length'] = self._limit
else:
to_list_arguments['length'] = DEFAULT_LIMIT

cursor = self._get_find_cursor(alias=alias)

Expand Down

0 comments on commit dc5d873

Please sign in to comment.