Skip to content
This repository

`None` should be an acceptable value for limit #50

Merged
merged 1 commit into from over 1 year ago

2 participants

Rafik Salama Jehiah Czebotar
Rafik Salama

My natural instinct when wanting queries to be unbounded is to set limit to None, not 0.* This seems like a reasonable thing to accommodate.

  • I'm aware of the default 101 batch size.
Jehiah Czebotar jehiah merged commit bf6919a into from August 18, 2012
Jehiah Czebotar jehiah closed this August 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 14, 2012
Rafik Salama None should be an acceptable value for limit dcc032e
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  asyncmongo/cursor.py
5  asyncmongo/cursor.py
@@ -332,12 +332,15 @@ def find(self, spec=None, fields=None, skip=0, limit=0,
332 332
         if spec is None:
333 333
             spec = {}
334 334
         
  335
+        if limit is None:
  336
+            limit = 0
  337
+
335 338
         if not isinstance(spec, dict):
336 339
             raise TypeError("spec must be an instance of dict")
337 340
         if not isinstance(skip, int):
338 341
             raise TypeError("skip must be an instance of int")
339 342
         if not isinstance(limit, int):
340  
-            raise TypeError("limit must be an instance of int")
  343
+            raise TypeError("limit must be an instance of int or None")
341 344
         if not isinstance(timeout, bool):
342 345
             raise TypeError("timeout must be an instance of bool")
343 346
         if not isinstance(snapshot, bool):
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.