Unsets done by update aggregation pipelines show up as replacement on change streams

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 7.0.5, 6.0.13, 5.0.24
    • Component/s: None
    • None
    • ALL
    • Hide

      db.test.insertOne({_id: 'foo', 'a': 0});

      // Watch the change stream

      const watchCursor = db.test.watch();

      while (!watchCursor.isClosed()) { let next = watchCursor.tryNext(); while (next !== null)

      { printjson(next); next = watchCursor.tryNext(); }

      }

      // In another shell

      db.test.updateOne({_id: 'foo'}, [{$unset: ['a']}]);

      Show
      db.test.insertOne({_id: 'foo', 'a': 0}); // Watch the change stream const watchCursor = db.test.watch(); while (!watchCursor.isClosed()) { let next = watchCursor.tryNext(); while (next !== null) { printjson(next); next = watchCursor.tryNext(); } } // In another shell db.test.updateOne({_id: 'foo'}, [{$unset: ['a'] }]);
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Running an update with an aggregation pipeline with an `$unset` stage results in a change stream event of `replace`, instead of `update` with the corresponding fields marked as `removedFields`

              Assignee:
              Katya Kamenieva
              Reporter:
              Kartal Kaan Bozdoğan
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: