Skip to content

Commit

Permalink
fix(query): apply schema-level select option from array schematypes
Browse files Browse the repository at this point in the history
Fix #10029
  • Loading branch information
vkarpov15 committed Mar 22, 2021
1 parent 7d19c9f commit 5ffbb8e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/queryhelpers.js
Expand Up @@ -199,7 +199,11 @@ exports.applyPaths = function applyPaths(fields, schema) {
schema.eachPath(function(path, type) {
if (prefix) path = prefix + '.' + path;

const addedPath = analyzePath(path, type);
let addedPath = analyzePath(path, type);
// arrays
if (addedPath == null && type.$isMongooseArray && !type.$isMongooseDocumentArray) {
addedPath = analyzePath(path, type.caster);
}
if (addedPath != null) {
addedPaths.push(addedPath);
}
Expand Down

0 comments on commit 5ffbb8e

Please sign in to comment.