Skip to content

Commit 67f8512

Browse files
committed
test: repro #8150
1 parent 32c4e3c commit 67f8512

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/document.test.js

+18
Original file line numberDiff line numberDiff line change
@@ -7904,6 +7904,24 @@ describe('document', function() {
79047904
});
79057905
});
79067906

7907+
it('caster that converts to Number class works (gh-8150)', function() {
7908+
return co(function*() {
7909+
const mySchema = new Schema({
7910+
id: {
7911+
type: Number,
7912+
set: value => new Number(value.valueOf())
7913+
}
7914+
});
7915+
7916+
const MyModel = db.model('gh8150', mySchema);
7917+
7918+
yield MyModel.create({ id: 12345 });
7919+
7920+
const doc = yield MyModel.findOne({ id: 12345 });
7921+
assert.ok(doc);
7922+
});
7923+
});
7924+
79077925
it('handles objectids and decimals with strict: false (gh-7973)', function() {
79087926
const testSchema = Schema({}, { strict: false });
79097927
const Test = db.model('gh7973', testSchema);

0 commit comments

Comments
 (0)