Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1579

Calling cursor.begin() multiple times while it is pending will cause an exception

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 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 ...
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            john.murphy@mongodb.com John Murphy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: