Skip to content

Commit

Permalink
test(bulkwrite): repro #10048
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftwareSing committed Mar 20, 2021
1 parent 1bb97ba commit 9559c46
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/model.test.js
Expand Up @@ -5780,6 +5780,35 @@ describe('Model', function() {
assert.equal(people[3].age, 30);
});
});

it('insertOne and replaceOne should not throw an error when set `timestamps: false` in schmea', function() {
const schema = new Schema({ name: String }, { timestamps: false });
const Model = db.model('Test', schema);

return co(function*() {
yield Model.create({ name: 'test' });

yield Model.bulkWrite([
{
insertOne: {
document: { name: 'insertOne-test' }
}
},
{
replaceOne: {
filter: { name: 'test' },
replacement: { name: 'replaceOne-test' }
}
}
]);

for (const name of ['insertOne-test', 'replaceOne-test']) {
const doc = yield Model.findOne({ name });
assert.strictEqual(doc.createdAt, undefined);
assert.strictEqual(doc.updatedAt, undefined);
}
});
});
});

it('insertMany with Decimal (gh-5190)', function(done) {
Expand Down

0 comments on commit 9559c46

Please sign in to comment.