We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72b4094 commit f94affdCopy full SHA for f94affd
lib/helpers/populate/assignVals.js
@@ -144,7 +144,7 @@ module.exports = function assignVals(o) {
144
145
const parts = _path.split('.');
146
let cur = docs[i];
147
- const curPath = parts[0];
+ let curPath = parts[0];
148
for (let j = 0; j < parts.length - 1; ++j) {
149
// If we get to an array with a dotted path, like `arr.foo`, don't set
150
// `foo` on the array.
@@ -167,6 +167,7 @@ module.exports = function assignVals(o) {
167
cur[parts[j]] = {};
168
}
169
cur = cur[parts[j]];
170
+ curPath += parts[j + 1] ? `.${parts[j + 1]}` : '';
171
// If the property in MongoDB is a primitive, we won't be able to populate
172
// the nested path, so skip it. See gh-7545
173
if (typeof cur !== 'object') {
0 commit comments