Skip to content

Commit

Permalink
fix(query+populate): avoid unnecessarily projecting in subpath when p…
Browse files Browse the repository at this point in the history
…opulating a path that uses an elemMatch projection

Fix #9973
  • Loading branch information
vkarpov15 committed Mar 10, 2021
1 parent 6c429ad commit 55c8d30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/helpers/query/selectPopulatedFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ function isPathInFields(userProvidedFields, path) {
const len = pieces.length;
let cur = pieces[0];
for (let i = 1; i < len; ++i) {
if (userProvidedFields[cur] != null) {
if (userProvidedFields[cur] != null || userProvidedFields[cur + '.$'] != null) {
return true;
}
cur += '.' + pieces[i];
}
return userProvidedFields[cur] != null;
return userProvidedFields[cur] != null || userProvidedFields[cur + '.$'] != null;
}

0 comments on commit 55c8d30

Please sign in to comment.