Details
-
Bug
-
Resolution: Works as Designed
-
Major - P3
-
None
-
3.2.0
-
None
-
None
Description
If a tailable cursor is opened against a collection, and it does not return any results on initial 3 calls to cursor.begin() it will fail with Cannot advance a completed or failed cursor.: generic server error.
This is due to this line of code which will advance the cursor without checking to see if there are any results available.
Suggest that the code be changed to something like:
if (libmongoc::cursor_more(_cursor->_impl->cursor_t) && |
libmongoc::cursor_next(_cursor->_impl->cursor_t, &out)) {
|
_cursor->_impl->doc = bsoncxx::document::view{bson_get_data(out), out->len};
|
} else if ... |