Commit Graph

9 Commits

Author SHA1 Message Date
Bernie Hackett
d8f0e4c000 PYTHON-894 - More doc clarifications for alive. 2015-05-07 15:00:37 -07:00
A. Jesse Jiryu Davis
f18b3644c2 PYTHON-894 - Set cursor.alive False after final batch.
Even with this change, "next" can raise StopIteration even though
"alive" is True. For example if batch size is 2 and there are 4
documents in the result set, then after the 4th document "alive" is True
but "next" raises StopIteration.
2015-04-17 16:19:03 -04:00
Bernie Hackett
eaaa54b903 PYTHON-893 - Fix application of SON manipulators in CommandCursor. 2015-04-14 11:07:51 -07:00
Bernie Hackett
a73e6cfb13 PYTHON-806 - Always use command cursor 'ns' value for OP_GET_MORE 2014-12-18 13:39:38 -08:00
A. Jesse Jiryu Davis
36c13e597e Expose some CommandCursor state. 2014-02-13 16:22:12 -05:00
Bernie Hackett
a217d30e72 Changes to make cursor testing easier. 2014-02-12 18:11:16 -08:00
Bernie Hackett
e3c809bd02 Gracefully kill cursor on capped rollover PYTHON-637
This change does a few things:

- Raises a new exception for CursorNotFound, inheriting from
OperationFailure so we don't break existing code.
- Catches the exception in cursor.Cursor and command_cursor.CommandCursor,
setting __killed to True.
- If the cursor is not tailable, re-raises the exception. This makes it
easier to deal with capped collection rollover when iterating a
tailable cursor.
2014-02-12 08:33:13 -08:00
Bernie Hackett
940d73f672 Add parallel_collection_scan helper PYTHON-633
This commit adds a helper for the new parallelCollectionScan
command introduced in MongoDB 2.5.5. The helper returns
"num_cursors" instances of CommandCursor that can be iterated
by one or more threads concurrently to scan the entire collection.

This commit also removes the remaining command cursor
hacks from cursor.Cursor.
2014-02-11 13:04:53 -08:00
Bernie Hackett
cdacc2f4b9 Fix aggregate cursor read preference issues PYTHON-636
The cursor returned by aggregate now knows what server
it was created on, allowing it to return getMore results
when the read preference is not PRIMARY.

This also introduces a simplified cursor class for use
with commands that return a cursor id and perhaps an initial
set of results. None of the methods of cursor.Cursor (other
than batch_size) make sense in this case.
2014-02-10 18:55:50 -08:00