Skip to content
This repository
Browse code

Merge branch 'master' of github.com:LearnBoost/mongoose

  • Loading branch information...
commit 3fbd07231f20af85374225a86f14528c2ef24660 2 parents 99a8050 + a235905
Aaron Heckmann aheckmann authored
10 History.md
Source Rendered
... ... @@ -1,4 +1,14 @@
1 1
  2 +1.1.15 / 2011-03-28
  3 +===================
  4 +
  5 + * Fixed; `null` and `undefined` are set atomically.
  6 +
  7 +1.1.14 / 2011-03-28
  8 +===================
  9 +
  10 + * Changed; more forgiving date casting, accepting '' as null.
  11 +
2 12 1.1.13 / 2011-03-26
3 13 ===================
4 14
2  lib/mongoose/index.js
@@ -281,7 +281,7 @@ exports.Connection = Connection;
281 281 * @param version
282 282 */
283 283
284   -exports.version = '1.1.13';
  284 +exports.version = '1.1.15';
285 285
286 286 /**
287 287 * Export Mongoose constructor
5 lib/mongoose/model.js
@@ -104,7 +104,10 @@ Model.prototype.save = function (fn) {
104 104 , atomics, val, obj;
105 105
106 106 if (type === null || type === undefined) {
107   - delta[data.path] = type;
  107 + if (!('$set' in delta))
  108 + delta['$set'] = {};
  109 +
  110 + delta['$set'][data.path] = type;
108 111 } else if (type._path && type.doAtomics) {
109 112 // a MongooseArray or MongooseNumber
110 113 atomics = type._atomics;
11 lib/mongoose/schema/date.js
@@ -42,7 +42,9 @@ SchemaDate.prototype.checkRequired = function (value) {
42 42 */
43 43
44 44 SchemaDate.prototype.cast = function (value) {
45   - if (value === null) return value;
  45 + if (value === null || value === '')
  46 + return null;
  47 +
46 48 if (value instanceof Date)
47 49 return value;
48 50
@@ -63,6 +65,12 @@ SchemaDate.prototype.cast = function (value) {
63 65 throw new CastError('date', value);
64 66 };
65 67
  68 +/**
  69 + * Date Query casting.
  70 + *
  71 + * @api private
  72 + */
  73 +
66 74 function handleSingle (val) {
67 75 return this.cast(val);
68 76 }
@@ -83,6 +91,7 @@ SchemaDate.prototype.$conditionalHandlers = {
83 91 , '$in': handleArray
84 92 , '$nin': handleArray
85 93 };
  94 +
86 95 SchemaDate.prototype.castForQuery = function ($conditional, val) {
87 96 var handler;
88 97 if (arguments.length === 2) {
2  package.json
... ... @@ -1,7 +1,7 @@
1 1 {
2 2 "name": "mongoose"
3 3 , "description": "Mongoose MongoDB ORM"
4   - , "version": "1.1.13"
  4 + , "version": "1.1.15"
5 5 , "author": "Guillermo Rauch <guillermo@learnboost.com>"
6 6 , "keywords": ["mongodb", "mongoose", "orm", "data", "datastore", "nosql"]
7 7 , "dependencies": {}
1  test/model.test.js
@@ -2744,7 +2744,6 @@ module.exports = {
2744 2744 (+post.get('meta').visitors).should.eql(4815162342);
2745 2745
2746 2746 db.close();
2747   -
2748 2747 }
2749 2748
2750 2749 };

0 comments on commit 3fbd072

Please sign in to comment.
Something went wrong with that request. Please try again.