New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

monk

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monk - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

6

History.md
0.1.10 / 2012-05-21
===================
* Enhanced findAndModify default behavior for upserts.
* Fixed findAndModify.
0.1.9 / 2012-05-16

@@ -3,0 +9,0 @@ ==================

13

lib/collection.js

@@ -247,2 +247,7 @@

// `new` defaults to `true` for upserts
if (null == opts.new && opts.upsert) {
opts.new = true;
}
if (fn) {

@@ -258,3 +263,9 @@ promise.on('complete', fn);

debug('%s findAndModify "%j" with "%j"', this.name, query.query, query.update);
this.col.findAndModify(query, this.opts(opts), promise.fulfill);
this.col.findAndModify(
query.query
, []
, query.update
, this.opts(opts)
, promise.fulfill
);

@@ -261,0 +272,0 @@ return promise;

2

package.json
{
"name": "monk"
, "version": "0.1.9"
, "version": "0.1.10"
, "main": "lib/monk.js"

@@ -5,0 +5,0 @@ , "dependencies": {

@@ -127,2 +127,43 @@

describe('findAndModifying', function () {
it('should alter an existing document', function (done) {
var rand = 'now-' + Date.now();
users.insert({ find: rand }, function (err, doc) {
expect(err).to.be(null);
users.findAndModify({ find: rand }, { find: 'woot' }, { new: true }, function (err, doc) {
expect(err).to.be(null);
expect(doc.find).to.be('woot');
users.findById(doc._id, function (err, found) {
expect(err).to.be(null);
expect(found._id.toString()).to.equal(doc._id.toString());
expect(found.find).to.be('woot');
done();
});
});
});
});
it('should upsert', function (done) {
function callback (err, doc) {
if (err) return done(err);
expect(doc.find).to.be(rand);
users.findOne({ find: rand }, function (err, found) {
expect(err).to.be(null);
expect(found._id.toString()).to.be(doc._id.toString());
expect(found.find).to.be(rand);
done();
});
};
var rand = 'now-' + Date.now();
users.findAndModify(
{ find: rand }
, { find: rand }
, { upsert: true }
, callback
);
});
});
describe('options', function () {

@@ -129,0 +170,0 @@ it('should allow defaults', function (done) {

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