File tree Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,6 @@ module.exports = function assignVals(o) {
144
144
145
145
const parts = _path . split ( '.' ) ;
146
146
let cur = docs [ i ] ;
147
- let curPath = parts [ 0 ] ;
148
147
for ( let j = 0 ; j < parts . length - 1 ; ++ j ) {
149
148
// If we get to an array with a dotted path, like `arr.foo`, don't set
150
149
// `foo` on the array.
@@ -160,14 +159,14 @@ module.exports = function assignVals(o) {
160
159
// If nothing to set, avoid creating an unnecessary array. Otherwise
161
160
// we'll end up with a single doc in the array with only defaults.
162
161
// See gh-8342, gh-8455
162
+ const curPath = parts . slice ( 0 , j + 1 ) . join ( '.' ) ;
163
163
const schematype = originalSchema . _getSchema ( curPath ) ;
164
164
if ( valueToSet == null && schematype != null && schematype . $isMongooseArray ) {
165
165
break ;
166
166
}
167
167
cur [ parts [ j ] ] = { } ;
168
168
}
169
169
cur = cur [ parts [ j ] ] ;
170
- curPath += parts [ j + 1 ] ? `.${ parts [ j + 1 ] } ` : '' ;
171
170
// If the property in MongoDB is a primitive, we won't be able to populate
172
171
// the nested path, so skip it. See gh-7545
173
172
if ( typeof cur !== 'object' ) {
You can’t perform that action at this time.
0 commit comments