Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-490

Cursor.Next should call getMore in a loop until a document is available

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.0.14
    • Affects Version/s: 0.0.9
    • Component/s: CRUD

      Fix how tailable cursors work. For context: GODRIVER-125.

      In particular, Cursor.Next should return false iff

      • an error occurred
      • the cursorId in the response is 0 and there are no documents left in the current batch of results

      Otherwise, it should call the getMore command in a loop until at least one document is returned in the next batch.

      Note: this should be done for all cursors, not just tailable. There's nothing in the wire protocol contract that says the server can't return an empty batch with a non-zero cursorId.

      Also, consider that the initiating command (e.g. find, aggregate) can return an empty first batch.

            Assignee:
            matthew.chiaravalloti@mongodb.com Matthew Chiaravalloti
            Reporter:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: