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()?
- is related to
-
CDRIVER-1221 mongoc_cursor_is_alive() returns false for live cursor from find command
- Closed
- related to
-
PHPC-673 Cursor::isDead() returns true despite cursor being alive
- Closed