@@ -305,7 +305,7 @@ def _fields_list_to_dict(self, fields):
305
305
return as_dict
306
306
307
307
def find (self , spec = None , fields = None , skip = 0 , limit = 0 ,
308
- slave_okay = None , timeout = True , snapshot = False ,
308
+ slave_okay = None , timeout = True , snapshot = False , tailable = False ,
309
309
_sock = None , _must_use_master = False ):
310
310
"""Query the database.
311
311
@@ -342,9 +342,15 @@ def find(self, spec=None, fields=None, skip=0, limit=0,
342
342
- `snapshot` (optional): if True, snapshot mode will be used for this
343
343
query. Snapshot mode assures no duplicates are returned, or objects
344
344
missed, which were present at both the start and end of the query's
345
- execution. For details, see the wiki_
346
-
347
- .. _wiki: http://www.mongodb.org/display/DOCS/How+to+do+Snapshotting+in+the+Mongo+Database
345
+ execution. For details, see the `wiki
346
+ <http://www.mongodb.org/display/DOCS/How+to+do+Snapshotting+in+the+Mongo+Database>`_.
347
+ - `tailable` (optional): the result of this find call will be a
348
+ tailable cursor - tailable cursors aren't closed when the last data
349
+ is retrieved but are kept open and the cursors location marks the
350
+ final document's position. if more data is received iteration of
351
+ the cursor will continue from the last document received. For
352
+ details, see the `wiki
353
+ <http://www.mongodb.org/display/DOCS/Tailable+Cursors>`_.
348
354
"""
349
355
if spec is None :
350
356
spec = SON ()
@@ -370,14 +376,17 @@ def find(self, spec=None, fields=None, skip=0, limit=0,
370
376
raise TypeError ("timeout must be an instance of bool" )
371
377
if not isinstance (snapshot , types .BooleanType ):
372
378
raise TypeError ("snapshot must be an instance of bool" )
379
+ if not isinstance (tailable , types .BooleanType ):
380
+ raise TypeError ("tailable must be an instance of bool" )
373
381
374
382
if fields is not None :
375
383
if not fields :
376
384
fields = ["_id" ]
377
385
fields = self ._fields_list_to_dict (fields )
378
386
379
- return Cursor (self , spec , fields , skip , limit , slave_okay , timeout , snapshot ,
380
- _sock = _sock , _must_use_master = _must_use_master )
387
+ return Cursor (self , spec , fields , skip , limit , slave_okay , timeout ,
388
+ tailable , snapshot , _sock = _sock ,
389
+ _must_use_master = _must_use_master )
381
390
382
391
def count (self ):
383
392
"""Get the number of documents in this collection.
0 commit comments