Skip to content

Commit

Permalink
test: repro #8150
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 15, 2019
1 parent 32c4e3c commit 67f8512
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/document.test.js
Expand Up @@ -7904,6 +7904,24 @@ describe('document', function() {
});
});

it('caster that converts to Number class works (gh-8150)', function() {
return co(function*() {
const mySchema = new Schema({
id: {
type: Number,
set: value => new Number(value.valueOf())
}
});

const MyModel = db.model('gh8150', mySchema);

yield MyModel.create({ id: 12345 });

const doc = yield MyModel.findOne({ id: 12345 });
assert.ok(doc);
});
});

it('handles objectids and decimals with strict: false (gh-7973)', function() {
const testSchema = Schema({}, { strict: false });
const Test = db.model('gh7973', testSchema);
Expand Down

0 comments on commit 67f8512

Please sign in to comment.