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

      eric.daniels brought up a use case from Stitch for a TryNext API for change streams. When Stitch creates a trigger on a relatively idle collection, Next calls can block for so long that the last seen resume token stored by Stitch falls off the oplog, making it impossible to use the token for restarting the change stream if an unclean shutdown happens.

      TryNext should be a non-blocking function that moves the cursor forward and attempts no more than 1 getMore. It should return true if the cursor was iterated successfully and false if the cursor was closed, a getMore attempt resulted in an error, or a getMore attempt returned an empty batch.

      david.golden suggested adding some sort of IsAlive function to test if TryNext should be called again after it returns false. We should also make sure to document that this should only be used with tailable cursors. Non-tailable cursors should use Next instead.

            Assignee:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Reporter:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: