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 0.0.5 to 0.0.6

.gitignore

36

lib/model.js

@@ -192,3 +192,9 @@ var EventEmitter = require('events').EventEmitter,

self.isNew = false;
if(fn) fn(err, docs);
if(fn) {
try {
fn(err, docs);
} catch (err) {
console.error(err.stack || err);
}
}
});

@@ -198,3 +204,9 @@ } else {

self._dirty = {};
if(fn) fn(err, docs);
if(fn) {
try {
fn(err, docs);
} catch (err) {
console.error(err.stack || err);
}
}
});

@@ -214,6 +226,20 @@ }

if (this.isNew){
if (fn) fn();
if (fn) {
try {
fn();
} catch (err) {
console.error(err.stack || err);
}
}
return this;
}
this._collection.remove({ _id: this._id }, fn || function(){});
this._collection.remove({ _id: this._id }, function(){
if (fn) {
try {
fn();
} catch (err) {
console.error(err.stack || err);
}
}
});
return this;

@@ -378,2 +404,2 @@ },

})();
})();

2

package.json
{ "name": "mongoose"
, "description": "ORM for MongoDB"
, "version": "0.0.5"
, "version": "0.0.6"
, "author": "LearnBoost <dev@learnboost.com>"

@@ -5,0 +5,0 @@ , "dependencies": { "mongodb": "0.7.9"}

@@ -143,3 +143,3 @@ require.paths.unshift('.')

User.find({}).all(function(docs){
assert.ok(!john.isNew);
assert.ok(!john.isNew);
assert.ok(docs.length == 1);

@@ -170,4 +170,40 @@ john.remove(function(){

});
},
"thrown exceptions don't re-execute callbacks on save": function(){
var db = mongoose.test()
, User = db.model('User')
, count = 0
var john = new User();
john.first = 'John';
john.last = 'Locke';
john.save(function(){
++count;
assert.equal(1, count);
setTimeout(function(){ db.terminate() }, 100);
throw new Error("made a boo boo");
});
},
"thrown exceptions don't re-execute callbacks on remove": function(){
var db = mongoose.test()
, User = db.model('User')
, count = 0
var john = new User();
john.first = 'John';
john.last = 'Locke';
john.save(function(){
john.remove(function(){
++count;
assert.equal(1, count);
setTimeout(function(){ db.terminate() }, 100);
throw new Error("made a boo boo");
});
});
}
};
};
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