Add a method to tell the end of the change stream

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Do
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Change Streams
    • None
    • None
    • Java Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      I'm using tailable change stream cursors and want to exit the execution as soon as I've traversed all documents. Currently, I don't see a direct way to detect end of stream with Java API. By my observations:

      • hasNext() blocks the thread until there is an dcoument to return, then returns true. It appears to be impossible for it to return anything but true.
      • next() blocks the thread until a new document is available.
      • tryNext() returns null without any indication on the cause. It may be due to exhausting the change stream, may be due to any other reason it couldn't fetch a document within timeout window.

      Request:

      Implement a method that conclusively and reliably tells when the change stream is exhausted.

      Library versions:
      org.mongodb:mongodb-driver-core:5.4.0
      org.mongodb:mongodb-driver-legacy:5.4.0
      org.mongodb:mongodb-driver-sync:5.4.0

            Assignee:
            Almas Abdrazak
            Reporter:
            George Fivetran (EXT)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: