If $setOnInsert has dontApply == true, it should probably bail out early from _appendNewFromMods like the rename mods:
case Mod::RENAME_FROM: case Mod::RENAME_TO: if (modState.dontApply) { return; }
Test
c = db.c;
c.drop();
c.save( { a:1 } );
c.update( {}, { $setOnInsert:{ 'b.c':1 }, $set:{ d:1 } } );
printjson( c.findOne() );
Output
{
"_id" : ObjectId("5127d71b69c410f31b5f2ef1"),
"a" : 1,
"b" : { // <-- There should not be a 'b' field here.
},
"d" : 1
}