$_internalApplyOplogUpdate breaks on a valid diff

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 8.0.24
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • Hide

      Run the above aggregation.

      Show
      Run the above aggregation.
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Enterprise dstCluster-rs [primary] test> db.aggregate([{$documents: [{$literal: {"$set": 123}}]}, {"$_internalApplyOplogUpdate":{"oplogUpdate":{"$v":2,"diff":{"u":{"$set":{"name":"yyy"}}}}}}])
      MongoServerError[DollarPrefixedFieldName]: PlanExecutor error during aggregation :: caused by :: The dollar ($) prefixed field '$set' in '$set' is not allowed in the context of an update's replacement document. Consider using an aggregation pipeline with $replaceWith.
      

      The intent—admittedly contrived—of the update is to set the value of the field “\$set” to {name:"yyy"}.

      This works in 8.0.21 but breaks in 8.0.24.

      To generate this sequence in the oplog:

      db.foo.insert({_id: 1, str: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"})
      db.foo.updateOne({_id: 1}, [{$replaceWith: {$setField: {field: {$literal:"$set"}, input: "$$ROOT", value: { name: "yyy" } }}}])
      

            Assignee:
            Unassigned
            Reporter:
            Felipe Gasper
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: