As explained in DOCS-64 it seems as $rename isn't behaving consistently.
If you're doing $rename :
{"source": "target"}while the source isn't existent but target is, Target won't be unset. If you're renaming another field which exists, through $rename :
{ "source":"target", "field":"exists"}target will be unset if source isn't set.
What I would expect is that there's a consistent behavior, favourable $rename shouldn't cause that target fields are overriden if source doesnt exists as $unset is available for deleting fields.
Further Mongoshell tests copy&pasted from the previously mentioned ticket are:
db.c.save({m:{a:1}}) db.c.findAndModify({query:{},update: {$rename: {"m.a":"b.a"}}}) { "_id" : ObjectId("4fc7737e03938522156ea7fd"), "m" : { "a" : 1 } } db.c.findAndModify({query:{},update: {$rename: {"m.a":"b.a"}}}) { "_id" : ObjectId("4fc7737e03938522156ea7fd"), "b" : { "a" : 1 }, "m" : { } } db.c.findAndModify({query:{},update: {$rename: {"m.a":"b.a"}}}) { "_id" : ObjectId("4fc7737e03938522156ea7fd"), "b" : { "a" : 1 }, "m" : { } } db.c.findAndModify({query:{}, update:{$rename: {"d":"b"}}}) { "_id" : ObjectId("4fc7737e03938522156ea7fd"), "b" : { "a" : 1 }, "m" : { } } db.c.findAndModify({query:{}, update:{$rename: {"d":"b"}}}) { "_id" : ObjectId("4fc7737e03938522156ea7fd"), "b" : { "a" : 1 }, "m" : { } } db.c.save({b: {a :1},d: {c:2}}) db.c.findAndModify({query:{},update:{$rename:{"d.c":"b.c","d.a":"b.a"}}}) { "_id" : ObjectId("4fc774d303938522156ea7fe"), "b" : { "a" : 1 }, "d" : { "c" : 2 } } db.c.find() { "_id" : ObjectId("4fc774d303938522156ea7fe"), "b" : { "c" : 2 }, "d" : { } } This does not happen if I do the following: db.c.save({b: {a :1,e:2},d: {c:2}}) db.c.findAndModify({query:{},update:{$rename:{"d.c":"b.c","d.e":"b.e"}}}) { "_id" : ObjectId("4fc776a903938522156ea803"), "b" : { "a" : 1, "e" : 2 }, "d" : { "c" : 2 } } db.c.find() { "_id" : ObjectId("4fc776a903938522156ea803"), "b" : { "a" : 1, "c" : 2 }, "d" : { } } This behavior can be spottet as well with this: db.c.save({b: {a :1,e:2},d: {c:2, f: 3}}) db.c.findAndModify({query:{},update:{$rename:{"d.c":"b.c","d.e":"b.e","d.a":"b.a"}}}) { "_id" : ObjectId("4fc7773403938522156ea805"), "b" : { "a" : 1, "e" : 2 }, "d" : { "c" : 2, "f" : 3 } } db.c.find() { "_id" : ObjectId("4fc7773403938522156ea805"), "b" : { "c" : 2 }, "d" : { "f" : 3 } } > db.test.save({a: 1, b: 2, c: 3}) > db.test.find() { "_id" : ObjectId("4fc7782f6b4d32f2145678de"), "a" : 1, "b" : 2, "c" : 3 } > db.test.update({}, {$rename: {"a":"b", "nonexistent": "c"}}) > db.test.find() { "_id" : ObjectId("4fc7782f6b4d32f2145678de"), "b" : 1 }