Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 59b03ce09c2167b72647c6e3ddba252d3b7709f8 1 parent f814a7b
@rauchg rauchg authored
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();
-
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.