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

mongoat

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoat - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

docs/mongoat/1.0.18/fonts/OpenSans-Bold-webfont.eot

4

lib/mongoat.js

@@ -259,3 +259,3 @@ 'use strict';

var id = docToProcess._id;
docToProcess._id = { _id: id, _version: docToProcess._version };
docToProcess._id = { _id: id, _version: docToProcess._version || 1 };
docToProcess._version = (opName === 'remove') ? 'deleted:' + docToProcess._version : (docToProcess._version || 1);

@@ -354,2 +354,2 @@

// export Mongoat object
module.exports = Mongoat;
module.exports = Mongoat;
{
"name": "mongoat",
"version": "2.0.3",
"version": "2.0.4",
"description": "Mongoat is a MongoDb ODM",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,3 +22,2 @@ 'use strict';

_this.testCol.datetime(true);
_this.testCol.version(true);
})

@@ -35,3 +34,3 @@ .then(done);

expect(mongObject.lastName).toBe('KHATAL');
expect(mongObject.age).toBe(25);
expect(mongObject.age).toBe(26);
expect(mongObject.company).toBe('Dial Once');

@@ -52,3 +51,3 @@ expect(mongObject.job).toBe('software engineer');

// test findAndModify without hooks
it('should upsert new document to Person collection', function (done) {
it('should upsert new document to Person collection [test with versionning disabled]', function (done) {
_this.testCol.findAndModify(

@@ -70,2 +69,3 @@ { firstName: 'Yacine' },

expect(mongObject.lastErrorObject.n).toBe(1);
expect(mongObject.value._version).toBeUndefined();
done();

@@ -75,2 +75,26 @@ });

// test findAndModify without hooks
it('should update new document to Person collection [test with versionning enabled]', function (done) {
_this.testCol.version(true);
_this.testCol.findAndModify(
{ firstName: 'Yacine' },
[['_id', 1]],
{ $set: { age: 26 } },
{ upsert: true, new: true },
function (err, mongObject) {
expect(err).toBe(null);
expect(typeof mongObject).toBe('object');
expect(typeof mongObject.value).toBe('object');
expect(typeof mongObject.lastErrorObject).toBe('object');
expect(mongObject.value.firstName).toBe('Yacine');
expect(mongObject.value.lastName).toBe('KHATAL');
expect(mongObject.value.age).toBe(26);
expect(mongObject.ok).toBe(1);
expect(mongObject.lastErrorObject.updatedExisting).toBe(true);
expect(mongObject.lastErrorObject.n).toBe(1);
expect(mongObject.value._version).toBe(2);
done();
});
});
// test with multiple before and after findAndModify hooks

@@ -99,3 +123,3 @@ it('should findAndModify document from Person collection and handle before and after update hooks', function (done) {

expect(mongObject.value.company).toBe('Dial Once');
expect(mongObject.value.age).toBe(25);
expect(mongObject.value.age).toBe(26);
expect(mongObject.ok).toBe(1);

@@ -115,3 +139,3 @@ expect(mongObject.lastErrorObject.updatedExisting).toBe(true);

expect(mongObject.value.company).toBe('Dial Once');
expect(mongObject.value.age).toBe(25);
expect(mongObject.value.age).toBe(26);
expect(mongObject.ok).toBe(1);

@@ -137,3 +161,3 @@ expect(mongObject.lastErrorObject.updatedExisting).toBe(true);

expect(mongObject.value.company).toBe('Dial Once');
expect(mongObject.value.age).toBe(25);
expect(mongObject.value.age).toBe(26);
expect(mongObject.ok).toBe(1);

@@ -140,0 +164,0 @@ expect(mongObject.lastErrorObject.updatedExisting).toBe(true);

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