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

cosa

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cosa - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

25

lib/db.js

@@ -148,2 +148,3 @@ const debug = require('debug')('cosa:db');

* @param {object} [options.findOne=false] - Should a single item be returned.
* @param {object} [options.readPreference] - the read preference for the query with one of the read constants
* @returns {Cursor} returns Cursor object

@@ -154,2 +155,3 @@ * @see {@link http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html}

* @see {@link http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#count}
* @see {@link https://github.com/mongodb/node-mongodb-native/blob/357cbf689735c2447bfb05d73c142f1a5b88ca91/lib/read_preference.js#L69}
*/

@@ -163,3 +165,4 @@ async find(collectionName, query, options) {

count: false,
findOne: false
findOne: false,
readPreference: undefined
});

@@ -179,7 +182,19 @@ query = EJSON.deserialize(query);

} else if (options.findOne) {
const findOptions = { projection: options.projection || options.fields, limit: options.limit, skip: options.skip, sort: options.sort };
const findOptions = {
projection: options.projection || options.fields,
limit: options.limit,
skip: options.skip,
sort: options.sort,
readPreference: options.readPreference
};
debug(`db.${collection.collectionName}.findOne`, query, findOptions);
return collection.findOne(query, options);
} else {
const findOptions = { projection: options.projection || options.fields, limit: options.limit, skip: options.skip, sort: options.sort };
const findOptions = {
projection: options.projection || options.fields,
limit: options.limit,
skip: options.skip,
sort: options.sort,
readPreference: options.readPreference
};
debug(`db.${collection.collectionName}.find (toArray)`, query, findOptions);

@@ -256,4 +271,6 @@ return collection.find(query, options);

* @param {boolean} [options.explain=false] - Should should the execution plan be returned.
* @param {object} [options.readPreference] - the read preference for the query
* @returns {Promise} resolves with the result of the aggregation from mongo
* @see {@link http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#aggregate}
* @see {@link https://github.com/mongodb/node-mongodb-native/blob/357cbf689735c2447bfb05d73c142f1a5b88ca91/lib/read_preference.js#L69}
*/

@@ -280,4 +297,6 @@ async aggregate(collectionName, pipeline, options) {

* @param {object} [options] - Optional settings see mongo documentation
* @param {object} [options.readPreference] - the read preference for the query
* @returns {Promise} resolves with the result of the distinct query from mongo
* @see {@link http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#distinct}
* @see {@link https://github.com/mongodb/node-mongodb-native/blob/357cbf689735c2447bfb05d73c142f1a5b88ca91/lib/read_preference.js#L69}
*/

@@ -284,0 +303,0 @@ async distinct(collectionName, key, query, options) {

6

package.json
{
"name": "cosa",
"version": "4.0.0",
"version": "4.0.1",
"description": "Cosa Models for MongoDB",

@@ -37,3 +37,3 @@ "main": "lib/index.js",

"dependencies": {
"bson": "~1.1.0",
"bson": "~1.1.4",
"clone": "^2.1.2",

@@ -45,3 +45,3 @@ "debug": "^4.1.1",

"@hapi/joi": "^17.1.0",
"mongodb": "~3.5.4",
"mongodb": "~3.5.8",
"mongodb-extended-json": "~1.11.0",

@@ -48,0 +48,0 @@ "object-assign": "^4.1.1",

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