Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-445

ChangeStream::next() should not increment key if ResumeTokenException is thrown

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

      The current behavior was previously introduced in PHPLIB-335 in 1.3.1, shortly after the introduction of change streams in 1.3.0. While I originally request that change, I'm no longer sure that it makes sense.

      In the event of a ResumeTokenException, no document is being returned to the user so there seems little value in incrementing the change stream key. The key itself has no direct relation to the underlying cursor and is merely a sequence for each event document returned during iteration. It seems sensible to only increment it when next() does return a document successfully. That would also be consistent with behavior when an exception is thrown by iterating the underlying cursor (i.e. call to next() on the internal iterator decorating the cursor), as the key is not advanced in that case.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: