We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 32c4e3c commit 67f8512Copy full SHA for 67f8512
test/document.test.js
@@ -7904,6 +7904,24 @@ describe('document', function() {
7904
});
7905
7906
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
7925
it('handles objectids and decimals with strict: false (gh-7973)', function() {
7926
const testSchema = Schema({}, { strict: false });
7927
const Test = db.model('gh7973', testSchema);
0 commit comments