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

@synatic/mongo-magic

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synatic/mongo-magic - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

60

lib/Collection.js
/* eslint-disable valid-jsdoc */
const {callbackify} = require('node:util');
const $moment = require('moment');

@@ -73,12 +74,15 @@ const $check = require('check-types');

const filter = query.parsedQuery.query || {};
this._collection
.countDocuments(filter, options)
.then((count) => {
if (!count) {
return callback(null, 0);
}
callbackify(() => {
return this._collection.countDocuments(filter, options);
})((err, count) => {
if (err) {
return callback(err);
}
return callback(null, count);
})
.catch(callback);
if (!count) {
return callback(null, 0);
}
return callback(null, count);
});
}

@@ -147,15 +151,14 @@

try {
const cursor = this.queryAsCursor(query, options);
callbackify(() => {
return this.queryAsCursor(query, options).toArray();
})((err, results) => {
if (err) {
return callback(err);
}
cursor
.toArray()
.then((results) => {
if (!results) {
return callback(null, []);
}
return callback(null, results);
})
.catch((err) => {
return callback(err);
});
if (!results) {
return callback(null, []);
}
return callback(null, results);
});
} catch (exp) {

@@ -230,8 +233,11 @@ return callback(exp);

}
this._collection
.updateOne(options.query, update)
.then((result) => {
return callback(null, result);
})
.catch(callback);
callbackify(() => {
return this._collection.updateOne(options.query, update);
})((err, result) => {
if (err) {
return callback(err);
}
return callback(null, result);
});
}

@@ -238,0 +244,0 @@

{
"name": "@synatic/mongo-magic",
"version": "2.2.0",
"version": "2.3.0",
"description": "Synatic utility classes for interacting with MongoDB",

@@ -5,0 +5,0 @@ "main": "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