Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1360

Add try_next to change stream iterators

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

      Currently there is seemingly no way to read a change stream without blocking forever when there is nothing happening on the server.

      This proposes to add a try_next method to change stream iterator modeled after java driver's tryNext: http://mongodb.github.io/mongo-java-driver/3.8/javadoc/com/mongodb/client/MongoCursor.html

      > Java's Iterator contract doesn't really allow that sort of timeout behavior, but the driver's MongoCursor class, which extends Iterator, offers a tryNext method that returns after every getMore, and can return null on an empty batch

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: