Added tailable and await_data options to find()
This commit is contained in:
@@ -90,7 +90,8 @@ class Collection(object):
|
||||
return {}
|
||||
|
||||
@coroutine
|
||||
def find(self, spec=None, skip=0, limit=0, fields=None, filter=None, _proto=None):
|
||||
def find(self, spec=None, skip=0, limit=0, fields=None, filter=None, _proto=None,
|
||||
tailable=False, await_data=False):
|
||||
if spec is None:
|
||||
spec = SON()
|
||||
|
||||
@@ -121,7 +122,8 @@ class Collection(object):
|
||||
proto = self._database._protocol
|
||||
else:
|
||||
proto = _proto
|
||||
return (yield from proto.OP_QUERY(str(self), spec, skip, limit, fields))
|
||||
return (yield from proto.OP_QUERY(str(self), spec, skip, limit, fields,
|
||||
tailable, await_data))
|
||||
|
||||
@coroutine
|
||||
def find_one(self, spec=None, fields=None, _proto=None):
|
||||
@@ -193,7 +195,7 @@ class Collection(object):
|
||||
|
||||
if callit is True:
|
||||
return None
|
||||
|
||||
|
||||
return result
|
||||
|
||||
@coroutine
|
||||
@@ -281,14 +283,14 @@ class Collection(object):
|
||||
|
||||
if "bucket_size" in kwargs:
|
||||
kwargs["bucketSize"] = kwargs.pop("bucket_size")
|
||||
|
||||
|
||||
index.update(kwargs)
|
||||
yield from self._database.system.indexes.insert(index, safe=True)
|
||||
return name
|
||||
|
||||
@coroutine
|
||||
def ensure_index(self, sort_fields, **kwargs):
|
||||
# ensure_index is an alias of create_index since we are not
|
||||
# ensure_index is an alias of create_index since we are not
|
||||
# keep an index cache same way pymongo does
|
||||
return (yield from self.create_index(sort_fields, **kwargs))
|
||||
|
||||
@@ -380,4 +382,4 @@ class Collection(object):
|
||||
return None
|
||||
else:
|
||||
raise ValueError("Unexpected Error: %s" % (result,))
|
||||
return result.get('value')
|
||||
return result.get('value')
|
||||
|
||||
Reference in New Issue
Block a user