Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2930

Allow setting batch size on change stream cursor

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.12.1, 1.11.9
    • Affects Version/s: None
    • Component/s: Change Streams
    • None
    • Not Needed
    • 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?

      Currently you can set batch size on a ChangeStream using ChangeStreamOptions.SetBatchSize. However, that applies to both the initial "aggregate" command as well as the subsequent "getMore" commands run while iterating the change stream. That can cause a problem when starting a change stream on low- or bursty-traffic collections because the initial aggregate won't return a cursor until the batch size is filled. The tailable cursor used by a change stream is intended to wait indefinitely for updates, but the initial "aggregate" command isn't, so will time out if there aren't enough changes to fill a batch, leading to an unexpected error.

      Definition of done:

      • Allow setting batch size on a ChangeStream after it's returned by Watch.

            Assignee:
            matt.dale@mongodb.com Matt Dale
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: