Inconsistent error reporting when advancing completed OP_QUERY and command cursor

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 1.4.0
    • Affects Version/s: 1.4.0
    • Component/s: libmongoc
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      While revising older PHPC tests to account for proper behavior noted in CDRIVER-1221, I realized another inconsistency between legacy and command cursor iteration.

      _mongoc_cursor_next() and _mongoc_cursor_cursorid_next() are used for OP_QUERY and command cursor iteration, respectively. Both return true or false depending on whether a BSON document has been read (i.e. *bson is checked), although they differ in how cursor->done is calculated.

      An superfluous call to _mongoc_cursor_next() results in a cursor error being set ("Cannot advance a completed or failed cursor."); however, a superfluous call to _mongoc_cursor_cursorid_next() raise no such error. In PHPC, this means that extra iteration on a complete cursor may or may not throw an exception, depending on the underlying protocol.

      Is it feasible to make these two methods consistent, either by having _mongoc_cursor_cursorid_next() set an error or removing the exception error from _mongoc_cursor_next()?

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: