Tested that an error is thrown when we try to change a document's _id

pull/2/head
Louis Chatriot 12 years ago
parent 529ff0137a
commit 3663b2b0b0
  1. 17
      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' ==== //

Loading…
Cancel
Save