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

jsft-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsft-mongodb - npm Package Compare versions

Comparing version 0.6.7 to 0.6.8

11

lib/_tests/Collection.test.js

@@ -438,2 +438,13 @@ 'use strict';

it('should skip update when no update props is provided', function () {
_Collection2.default.updateOne.reset();
_Collection2.default.insertOne.reset();
return _Collection2.default.upsertOne('tests', _testSchema2.default, entity, {}, {}).then(function (res) {
_sinon2.default.assert.notCalled(_Collection2.default.insertOne);
_sinon2.default.assert.notCalled(_Collection2.default.updateOne);
(0, _chai.expect)(res).to.equal(entity);
});
});
it('should run insertOne for entity without id', function () {

@@ -440,0 +451,0 @@ _Collection2.default.updateOne.reset();

12

lib/Collection.js

@@ -348,3 +348,13 @@ 'use strict';

return entity.id ? Collection.updateOne(collectionName, schema, _extends({}, updateProps, { id: entity.id })) : Collection.insertOne(collectionName, schema, _extends({}, insertOnlyProps, updateProps));
if (entity.id !== undefined) {
// Update existing entity
if (Object.keys(updateProps).length === 0) {
// No properties to update
return Promise.resolve(entity);
}
return Collection.updateOne(collectionName, schema, _extends({}, updateProps, { id: entity.id }));
} else {
// Insert new entity
return Collection.insertOne(collectionName, schema, _extends({}, insertOnlyProps, updateProps));
}
};

@@ -351,0 +361,0 @@

2

package.json
{
"name": "jsft-mongodb",
"version": "0.6.7",
"version": "0.6.8",
"description": "Functional abstraction layer for mongodb-storage of objects with structures defined with json-schema",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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