Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-85923

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • 7.0.5, 6.0.13
    • 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'] }]);

    Description

      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`

      Attachments

        Activity

          People

            Unassigned Unassigned
            kartalkaan.bozdogan@ocell.io Kartal Kaan Bozdoğan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: