diff --git a/test/db.test.js b/test/db.test.js index b3084bb..dc9f5a9 100644 --- a/test/db.test.js +++ b/test/db.test.js @@ -614,6 +614,23 @@ describe('Database', function () { }); }); + it('Cant change the _id of a document', function (done) { + d.insert({ a: 2 }, function (err, newDoc) { + d.update({ a: 2 }, { _id: 'nope' }, {}, function (err) { + assert.isDefined(err); + + d.find({}, function (err, docs) { + docs.length.should.equal(1); + Object.keys(docs[0]).length.should.equal(2); + docs[0].a.should.equal(2); + docs[0]._id.should.equal(newDoc._id); + + done(); + }); + }); + }); + }); + }); // ==== End of 'Update' ==== //