Clone change stream watch options in shell

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: Change streams, Shell
    • None
    • Query Execution
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The change stream watch commands offered by the mongo jstest shell take an `options` argument for the change stream's options, but the internal function that passes the options to the change stream aggregate command modifies this `options` object in-place, deleting keys from it. For example, when passing the same `options` object to 2 separate change stream watch commands, the first call can silently remove options from the original object, so that the second call will effectively use different options:

      const options =

      {showExpandedEvents: true}

      ;

      // Change stream is opened with

      {showExpandedEvents: true}

      , but call
      // silently drops 'showExpandedEvents' flag from 'options'.
      coll.watch([], options);

      // Change stream is opened with only {}!
      coll.watch([], options);

      This change fixes that by cloning the input options, so that the original options remain unmodified throughout multiple calls to watch.

            Assignee:
            Jan Steemann
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: