Permalink
Browse files

Fixed; `null` and `undefined` are set atomically

  • Loading branch information...
1 parent f814a7b commit 59b03ce09c2167b72647c6e3ddba252d3b7709f8 @rauchg rauchg committed Mar 28, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −1 lib/mongoose/model.js
  2. +0 −1 test/model.test.js
View
5 lib/mongoose/model.js
@@ -104,7 +104,10 @@ Model.prototype.save = function (fn) {
, atomics, val, obj;
if (type === null || type === undefined) {
- delta[data.path] = type;
+ if (!('$set' in delta))
+ delta['$set'] = {};
+
+ delta['$set'][data.path] = type;
} else if (type._path && type.doAtomics) {
// a MongooseArray or MongooseNumber
atomics = type._atomics;
View
1 test/model.test.js
@@ -2740,7 +2740,6 @@ module.exports = {
(+post.get('meta').visitors).should.eql(234);
db.close();
-
}
};

0 comments on commit 59b03ce

Please sign in to comment.