We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
mongoosejs
Learn more about funding links in repositories.
Report abuse
1 parent 4b0052e commit 7d19c9fCopy full SHA for 7d19c9f
test/query.test.js
@@ -3757,4 +3757,23 @@ describe('Query', function() {
3757
assert.equal(called.length, 1);
3758
});
3759
3760
+
3761
+ it('applies schema-level `select` on arrays (gh-10029)', function() {
3762
+ const testSchema = new mongoose.Schema({
3763
+ doesntpopulate: {
3764
+ type: [mongoose.Schema.Types.ObjectId],
3765
+ select: false
3766
+ },
3767
+ populatescorrectly: [{
3768
+ type: mongoose.Schema.Types.ObjectId,
3769
3770
+ }]
3771
+ });
3772
+ const Test = db.model('Test', testSchema);
3773
3774
+ const q = Test.find();
3775
+ q._applyPaths();
3776
3777
+ assert.deepEqual(q._fields, { doesntpopulate: 0, populatescorrectly: 0 });
3778
3779
0 commit comments