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

mongo-query-builder-chain

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-query-builder-chain - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

.idea/codeStyles/codeStyleConfig.xml

6

demo.js

@@ -26,2 +26,4 @@ const mongoQBModule = require('./module');

.addToQuery(['field4'], mongoQBModule.MongoQuery.$lte(mongoQBModule.MongoQuery.$date(1593727200000)), true)
.removeFromQuery(['field3'])
.addToQuery(['field5'], 1)
.addToQuery([], mongoQBModule.MongoQuery.$language(), true)

@@ -39,1 +41,5 @@ .projectionAdd(['projection_field2', 'projection_field3', 'projection_field4'])

.getValue(), false, null, true));
console.log(mongoQB.hasKey(['field2']));
console.log(mongoQB.hasKey(['field3']));
console.log(mongoQB.hasKey(['field1', '$ne']));

@@ -96,2 +96,17 @@ var helpers = require('./helpers');

hasKey(keyPath = []) {
if (Array.isArray(keyPath)) {
let value = this.body.query;
keyPath.forEach(key => {
if (!value) {
return false;
}
value = value[key];
});
return !!value;
} else {
throw "Argument keyPath must be an array!";
}
}
getValue(keyPath = []) {

@@ -98,0 +113,0 @@ if (Array.isArray(keyPath)) {

2

package.json

@@ -20,3 +20,3 @@ {

"type": "module",
"version": "1.1.1"
"version": "1.1.2"
}

@@ -39,2 +39,7 @@ # mongo-query-builder-chain

Checks whether the key _field11_ under _field1_ exists in the query. It returns true or false.
```javascript
mongoQuery.hasKey(['field1', 'field11']);
```
Create a clause with a key _clause_field_ with a value _clause_value_

@@ -41,0 +46,0 @@ ```javascript

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