-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
CDRIVER-1221 explains in this comment that mongoc_cursor_is_alive should return true until mongoc_cursor_next returns NULL.
The docs for mongoc_cursor_is_alive say
Checks to see if a cursor is in a state that allows contacting a server to check for more documents. Note that even if false, there may be documents already retrieved that can be iterated using mongoc_cursor_next().
The docs don't match the behavior. When the last batch is returned (with a cursor id of 0) we know we won't be contacting the server again, yet mongoc_cursor_is_alive will continue to return true (shown in this test).
The current implementation is consistent with older behavior, so I don't think we should change it. However, we should update the documentation and consider deprecating it in favor of mongoc_cursor_more, which should behave the same (the done flag is set when the cursor id is 0 and there are no documents left in the last batch). As a sanity check, I replaced all calls of mongoc_cursor_is_alive with mongoc_cursor_more to verify tests passed.
- is related to
-
CDRIVER-2604 Remove mongoc_cursor_is_alive
- Backlog