I want to update an empty nested field from another nested field value. I'm using this Mongo Shell command:
db.myCollection.updateMany({"object2.field": ""}, { $set: {"object2.field": '$object1.field' } } );
But $object1.field is not resolved and the destination field actually contains the variable name instead of its content.
I've performed many tests and documentation searches but with no success.
[{ $set: { "object1.field": "$object2.field" } }]