File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ def __send_message(self, msg):
126126 self .__retrieved += response ["number_returned" ]
127127 self .__data = deque (response ["data" ])
128128
129- def __refresh (self ):
129+ def _refresh (self ):
130130 """Refreshes the cursor with more data from the server.
131131
132132 Returns the length of self.__data after refresh. Will exit early if
@@ -146,13 +146,23 @@ def __refresh(self):
146146
147147 return len (self .__data )
148148
149+ @property
150+ def alive (self ):
151+ """Does this cursor have the potential to return more data?"""
152+ return bool (len (self .__data ) or (not self .__killed ))
153+
154+ @property
155+ def cursor_id (self ):
156+ """Returns the id of the cursor."""
157+ return self .__id
158+
149159 def __iter__ (self ):
150160 return self
151161
152162 def next (self ):
153163 """Advance the cursor.
154164 """
155- if len (self .__data ) or self .__refresh ():
165+ if len (self .__data ) or self ._refresh ():
156166 coll = self .__collection
157167 return coll .database ._fix_incoming (self .__data .popleft (), coll )
158168 else :
You can’t perform that action at this time.
0 commit comments