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

p-odm

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-odm - npm Package Compare versions

Comparing version 3.1.14 to 3.1.15

48

lib/index.js

@@ -268,7 +268,55 @@ 'use strict';

* @memberOf ODM
*
* @param {String} collection_name
* @param {Object} query
* @param {Object} sort
* @param {Object} document
* @param {Object} options
* @param {Function} callback
*/
findAndModify: function (collection_name, query, sort, document, options, callback) {
var wantCursor = extractOption('cursor', options, false);
ODM.collection(collection_name, options, function (err, collection) {
if (err) {
return callback(err);
}
return collection.findAndModify(query, sort, document, options, function (err, cursor) {
if (err) {
return callback(err);
}
if (wantCursor) {
if (cursor.state !== Cursor.CLOSED) {
return callback(null, cursor);
}
return callback('Cursor is closed');
}
return cursor.toArray(function (err, array) {
if (err) {
return callback(err);
}
// clean resources
if (!cursor.isClosed()) {
cursor.close();
}
return callback(null, array);
});
});
});
},
/**
* @static
* @memberOf ODM
* @param {String} collection_name
* @param {Object} query
* @param {Object} options
* @param {Function} callback
*/
count: function (collection_name, query, options, callback) {

@@ -275,0 +323,0 @@ ODM.collection(collection_name, options, function (err, collection) {

@@ -293,2 +293,22 @@ /**

/**
* Updates a set of documents and returns the updates docs.
*
* @static
* @memberOf Model
* @param {Object} query MongoDB Query
* @param {Object} sort sorting order
* @param {Object} document update
* @param {Object} [options] options for the query
* @param {Function} callback Callback function (error, model) with the result of the operation
*/
Model.findAndModify = function (query, sort, document, options, callback) {
if (callback === undefined) {
callback = options;
options = {};
}
return odm.findAndModify(mongoCollection, query, sort, document, options, callback);
};
/**
* Finds all elements in this collection.

@@ -655,2 +675,20 @@ *

/**
* Updates a set of documents and returns the updates docs.
*
* @static
* @memberOf Model
* @param {Object} document update
* @param {Object} [options] options for the query
* @param {Function} callback Callback function (error, model) with the result of the operation
*/
Model.prototype.findAndModify = function (document, options, callback) {
if (callback === undefined) {
callback = options;
options = {};
}
return odm.findAndModify(mongoCollection, {_id: self._id}, {_id: 'asc'}, document, options, callback);
};
/**
* Creates a snapshot of this object instance.

@@ -657,0 +695,0 @@ *

4

package.json

@@ -8,3 +8,3 @@ {

],
"version": "3.1.14",
"version": "3.1.15",
"engines": {

@@ -14,3 +14,3 @@ "node": ">=0.4.12"

"dependencies": {
"mongodb": "1.2.5",
"mongodb": "1.2.12",
"jsonschema": "0.3.2"

@@ -17,0 +17,0 @@ },

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