Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose

Package Overview
Dependencies
Maintainers
0
Versions
892
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

7

History.md
1.1.3 / 2011-03-04
==================
* Added Promise#resolve [aheckmann]
* Fixed backward compatibility with nulls [aheckmann]
* Changed; Query#{run,exec} return promises [aheckmann]
1.1.2 / 2011-03-03

@@ -3,0 +10,0 @@ ==================

30

lib/mongoose/document.js

@@ -117,3 +117,3 @@

if (!schema && obj[i].constructor == Object){ // assume nested object
if (!schema && obj[i] && obj[i].constructor == Object){ // assume nested object
doc[i] = {};

@@ -569,4 +569,7 @@ init(obj[i], doc[i], path + '.');

var self = this
, args = arguments;
, args = arguments
, pres = this.pres[methodName];
if (!pres) return oldFn.apply(this, args);
function error (err){

@@ -577,18 +580,15 @@ var lastArg = args[args.length-1];

}
var pres = this.pres[methodName];
if (!pres) return oldFn.apply(this, args);
var pres = this.pres[methodName]
, chain = pres.serial.map(function (fn, i) {
return function (err) {
if (arguments.callee._hookCalled) return;
var chain = pres.serial.map(function (fn, i) {
return function (err) {
if (arguments.callee._hookCalled) return;
if (err instanceof Error)
error(err);
else
fn.call(self, chain[i+1] || parallel);
if (err instanceof Error)
error(err);
else
fn.call(self, chain[i+1] || parallel);
arguments.callee._hookCalled = true;
};
});
arguments.callee._hookCalled = true;
};
});

@@ -595,0 +595,0 @@ chain.length ? chain[0]() : parallel();

@@ -284,3 +284,3 @@

exports.version = '1.1.2';
exports.version = '1.1.3';

@@ -287,0 +287,0 @@ /**

@@ -121,2 +121,17 @@

/**
* Sugar for handling cases where you may be
* resolving to either an error condition or a
* success condition.
*
* @param {Error} optional error or null
* @param {Object} value to complete the promise with
* @api public
*/
Promise.prototype.resolve = function (err, val) {
if (err) return this.error(err);
return this.complete(val);
};
/**
* Module exports.

@@ -123,0 +138,0 @@ */

var utils = require('./utils')
, merge = utils.merge
, Promise = require('./promise')
, inGroupsOf = utils.inGroupsOf;

@@ -35,16 +36,23 @@

Query.prototype.exec = function (op, callback) {
var args = arguments;
if ('function' === typeof op) {
callback = op;
if (this.op === 'update') {
return this[this.op](this._updateArg, callback);
}
return this[this.op](callback);
var promise = new Promise();
switch (typeof op) {
case 'function':
callback = op;
op = null;
break;
case 'string':
this.op = op;
break;
}
args = Array.prototype.slice.call(arguments, 1);
this.op = op;
if (op === 'update' && args.length === 1) {
args.unshift(this._updateArg);
if (callback) promise.addBack(callback);
if ('update' == this.op) {
this.update(this._updateArg, promise.resolve.bind(promise));
return promise;
}
this[op].apply(this, args);
this[this.op](promise.resolve.bind(promise));
return promise;
};

@@ -51,0 +59,0 @@

{
"name": "mongoose"
, "description": "Mongoose MongoDB ORM"
, "version": "1.1.2"
, "version": "1.1.3"
, "author": "Guillermo Rauch <guillermo@learnboost.com>"

@@ -6,0 +6,0 @@ , "keywords": ["mongodb", "mongoose", "orm", "data", "datastore", "nosql"]

@@ -1041,4 +1041,19 @@

'test backwards compatibility with previously existing null values in db': function () {
var db = start()
, BlogPostB = db.model('BlogPostB', collection)
, post = new BlogPostB();
post.collection.insert({ meta: { visitors: 9898, a: null } }, {}, function (err, b) {
should.strictEqual(err, null);
BlogPostB.findOne({_id: b[0]._id}, function (err, found) {
should.strictEqual(err, null);
found.get('meta.visitors').valueOf().should.eql(9898);
db.close();
})
})
}
// IDIOMATIC SYNTAX TESTS
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc