Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-2435

Why does change stream end when more logs exist

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: API

      Hi,

      I'm using change streams to gather statistics about my operations (need to take some info from each insert/update) - so I need it to act as a listener without closing.

      I inserted 1,000,000 documents into a collection and on the change stream side I am using the start_at_operation_time() option to gather all the required info.

      I noticed that the change stream closes randomly before all 1M objects are viewed (using a counter in the loop).

      Also, I noticed that when I configure the max_await_time() to 5000 ms then it works fine and all documents are captured before it closes.

      The behavior I need is to have the change-stream as a listener that waits for changes all the time. 

      Is there a way to have this loop blocking? meaning that it will always wait for the next incoming change without exiting the loop.

      I saw that someone once issued a "bug" about it, but this is the behavior I want to implement:

      https://jira.mongodb.org/browse/CXX-2278?jql=project%20%3D%20CXX%20AND%20component%20%3D%20Implementation

      From some POCs that I made with Golang and python driver, it looks like they are always blocking and waiting for the next change.

       

      mongocxx driver version: 3.6.6

      mongoc driver version: 1.20.1

       

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            oraiches@zadarastorage.com Oded Raiches
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: