@@ -1130,8 +1130,8 @@ Document.prototype.$set = function $set(path, val, type, options) {
1130
1130
}
1131
1131
1132
1132
if ( utils . isNonBuiltinObject ( valForKey ) && pathtype === 'nested' ) {
1133
- this . $set ( prefix + key , path [ key ] , constructing , Object . assign ( { } , options , { _skipMarkModified : true } ) ) ;
1134
- $applyDefaultsToNested ( this . $get ( prefix + key ) , prefix + key , this ) ;
1133
+ this . $set ( pathName , path [ key ] , constructing , Object . assign ( { } , options , { _skipMarkModified : true } ) ) ;
1134
+ $applyDefaultsToNested ( this . $get ( oathName ) , pathName , this ) ;
1135
1135
continue ;
1136
1136
} else if ( strict ) {
1137
1137
// Don't overwrite defaults with undefined keys (gh-3981) (gh-9039)
@@ -1146,9 +1146,9 @@ Document.prototype.$set = function $set(path, val, type, options) {
1146
1146
1147
1147
if ( pathtype === 'real' || pathtype === 'virtual' ) {
1148
1148
const p = path [ key ] ;
1149
- this . $set ( prefix + key , p , constructing , options ) ;
1149
+ this . $set ( pathName , p , constructing , options ) ;
1150
1150
} else if ( pathtype === 'nested' && path [ key ] instanceof Document ) {
1151
- this . $set ( prefix + key ,
1151
+ this . $set ( pathName ,
1152
1152
path [ key ] . toObject ( { transform : false } ) , constructing , options ) ;
1153
1153
} else if ( strict === 'throw' ) {
1154
1154
if ( pathtype === 'nested' ) {
@@ -1158,7 +1158,7 @@ Document.prototype.$set = function $set(path, val, type, options) {
1158
1158
}
1159
1159
}
1160
1160
} else if ( path [ key ] !== void 0 ) {
1161
- this . $set ( prefix + key , path [ key ] , constructing , options ) ;
1161
+ this . $set ( pathName , path [ key ] , constructing , options ) ;
1162
1162
}
1163
1163
}
1164
1164
0 commit comments