Skip to content

Commit

Permalink
Merge branch 'master' of github.com:LearnBoost/mongoose
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Mar 28, 2011
2 parents 99a8050 + a235905 commit 3fbd072
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
10 changes: 10 additions & 0 deletions 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
===================

Expand Down
2 changes: 1 addition & 1 deletion lib/mongoose/index.js
Expand Up @@ -281,7 +281,7 @@ exports.Connection = Connection;
* @param version
*/

exports.version = '1.1.13';
exports.version = '1.1.15';

/**
* Export Mongoose constructor
Expand Down
5 changes: 4 additions & 1 deletion lib/mongoose/model.js
Expand Up @@ -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;
Expand Down
11 changes: 10 additions & 1 deletion lib/mongoose/schema/date.js
Expand Up @@ -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;

Expand All @@ -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);
}
Expand All @@ -83,6 +91,7 @@ SchemaDate.prototype.$conditionalHandlers = {
, '$in': handleArray
, '$nin': handleArray
};

SchemaDate.prototype.castForQuery = function ($conditional, val) {
var handler;
if (arguments.length === 2) {
Expand Down
2 changes: 1 addition & 1 deletion 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": {}
Expand Down
1 change: 0 additions & 1 deletion test/model.test.js
Expand Up @@ -2744,7 +2744,6 @@ module.exports = {
(+post.get('meta').visitors).should.eql(4815162342);

db.close();

}

};

0 comments on commit 3fbd072

Please sign in to comment.