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

@coolgk/mongo

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coolgk/mongo - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

5

mongo.d.ts
/*!
* @package @coolgk/mongo
* @version 1.0.11
* @version 1.0.12
* @link https://coolgk.github.io/mongodb-orm.html

@@ -79,5 +79,2 @@ * @license MIT

};
error?: {
[action: string]: any;
};
}

@@ -84,0 +81,0 @@ export interface IUpdateOption extends FindOneAndReplaceOption {

16

mongo.js
/*!
* @package @coolgk/mongo
* @version 1.0.11
* @version 1.0.12
* @link https://coolgk.github.io/mongodb-orm.html

@@ -116,2 +116,3 @@ * @license MIT

const dataBeforeUpdate = options.revertOnError ? yield this._collection.findOne({ _id: data._id }) : false;
const errors = {};
for (const action of ['$set', '$push', '$pull']) {

@@ -126,6 +127,3 @@ if (!queries[action]) {

}, Object.assign({}, options, { arrayFilters: queries[action].arrayFilters })).catch((error) => {
if (!results.error) {
results.error = {};
}
results.error[action] = error;
errors[action] = error;
})) || {};

@@ -141,10 +139,10 @@ if (options.returnOriginal) {

}
if (results.error) {
if (Object.keys(errors).length) {
if (options.revertOnError) {
const revertResult = yield this._collection.findOneAndReplace({ _id: dataBeforeUpdate._id }, dataBeforeUpdate).catch((revertError) => {
results.error.$revert = revertError;
errors.$revert = revertError;
});
}
const error = new MongoError('UpdateOne Error: ' + JSON.stringify(results.error));
error.data = results;
const error = new MongoError('UpdateOne Error: ' + JSON.stringify(errors));
error.data = Object.assign({}, results, { error: errors });
throw error;

@@ -151,0 +149,0 @@ }

@@ -1,1 +0,1 @@

{"name":"@coolgk/mongo","version":"1.0.11","description":"A javascript / typescript MongoDB modelling library which enables joins in collections, simplifies CRUD operations for sub / nested documents and implements schema based data validation","main":"./mongo.js","types":"./mongo.d.ts","dependencies":{"@coolgk/array":"^2.0.4","mongodb":"^3.0.3"},"author":"Daniel Gong <daniel.k.gong@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/coolgk/node-mongo/issues"},"homepage":"https://coolgk.github.io/mongodb-orm.html","keywords":["mongo","MongoDB","orm","odm","relational","data validation","join"]}
{"name":"@coolgk/mongo","version":"1.0.12","description":"A javascript / typescript MongoDB modelling library which enables joins in collections, simplifies CRUD operations for sub / nested documents and implements schema based data validation","main":"./mongo.js","types":"./mongo.d.ts","dependencies":{"@coolgk/array":"^2.0.4","mongodb":"^3.0.4"},"author":"Daniel Gong <daniel.k.gong@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/coolgk/node-mongo/issues"},"homepage":"https://coolgk.github.io/mongodb-orm.html","keywords":["mongo","MongoDB","orm","odm","relational","data validation","join"]}
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