Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 3fbd07231f20af85374225a86f14528c2ef24660 2 parents 99a8050 + a235905
@aheckmann aheckmann authored
View
10 History.md
@@ -1,4 +1,14 @@
+1.1.15 / 2011-03-28
+===================
+
+ * Fixed; `null` and `undefined` are set atomically.
+
+1.1.14 / 2011-03-28
+===================
+
+ * Changed; more forgiving date casting, accepting '' as null.
+
1.1.13 / 2011-03-26
===================
View
2  lib/mongoose/index.js
@@ -281,7 +281,7 @@ exports.Connection = Connection;
* @param version
*/
-exports.version = '1.1.13';
+exports.version = '1.1.15';
/**
* Export Mongoose constructor
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
11 lib/mongoose/schema/date.js
@@ -42,7 +42,9 @@ SchemaDate.prototype.checkRequired = function (value) {
*/
SchemaDate.prototype.cast = function (value) {
- if (value === null) return value;
+ if (value === null || value === '')
+ return null;
+
if (value instanceof Date)
return value;
@@ -63,6 +65,12 @@ SchemaDate.prototype.cast = function (value) {
throw new CastError('date', value);
};
+/**
+ * Date Query casting.
+ *
+ * @api private
+ */
+
function handleSingle (val) {
return this.cast(val);
}
@@ -83,6 +91,7 @@ SchemaDate.prototype.$conditionalHandlers = {
, '$in': handleArray
, '$nin': handleArray
};
+
SchemaDate.prototype.castForQuery = function ($conditional, val) {
var handler;
if (arguments.length === 2) {
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "mongoose"
, "description": "Mongoose MongoDB ORM"
- , "version": "1.1.13"
+ , "version": "1.1.15"
, "author": "Guillermo Rauch <guillermo@learnboost.com>"
, "keywords": ["mongodb", "mongoose", "orm", "data", "datastore", "nosql"]
, "dependencies": {}
View
1  test/model.test.js
@@ -2744,7 +2744,6 @@ module.exports = {
(+post.get('meta').visitors).should.eql(4815162342);
db.close();
-
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.