Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2594

Update docs for cursor_is_alive and consider deprecating

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.10.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: