Skip to content

Commit

Permalink
test(query): repro #7017
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 25, 2018
1 parent 477e8ca commit 5ec10b6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/schema.select.test.js
Expand Up @@ -388,6 +388,27 @@ describe('schema select option', function() {
assert.equal(doc.b, 'bar');
});
});

it('omits if not in schema (gh-7017)', function() {
const M = db.model('gh7017', new Schema({
a: { type: String, select: false },
b: { type: String, select: false }
}), 'gh7017');

return co(function*() {
yield db;
yield db.db.collection('gh7017').insertOne({
a: 'foo',
b: 'bar',
c: 'baz'
});

const doc = yield M.find({}, '+c').then(res => res[0]);
assert.strictEqual(doc.a, void 0);
assert.strictEqual(doc.b, void 0);
assert.equal(doc.c, 'baz');
});
});
});

it('conflicting schematype path selection should not error', function(done) {
Expand Down

0 comments on commit 5ec10b6

Please sign in to comment.