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

@cocreate/mongodb

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/mongodb - npm Package Compare versions

Comparing version 1.17.6 to 1.18.0

7

CHANGELOG.md

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

# [1.18.0](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.6...v1.18.0) (2024-04-28)
### Features
* handle date queries ([7d437f2](https://github.com/CoCreate-app/CoCreate-mongodb/commit/7d437f28a98b1c89066a7be3885cba137a524d65))
## [1.17.6](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.5...v1.17.6) (2024-02-20)

@@ -2,0 +9,0 @@

2

package.json
{
"name": "@cocreate/mongodb",
"version": "1.17.6",
"version": "1.18.0",
"description": "A simple mongodb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -635,5 +635,40 @@ const { MongoClient, ObjectId } = require('mongodb');

if (data.$filter) {
if (data.$filter.query)
query = data.$filter.query
function convertIfDate(value) {
if (typeof value === 'string' && value.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/)) {
return new Date(value);
}
return value;
}
if (data.$filter.query) {
for (let key in data.$filter.query) {
if (Array.isArray(data.$filter.query[key])) {
// Handle $or operator with an array of conditions
query[key] = data.$filter.query[key].map(condition => {
let newCondition = {};
for (let subKey in condition) {
if (typeof condition[subKey] === 'object' && condition[subKey] !== null) {
newCondition[subKey] = {};
for (let subCondition in condition[subKey]) {
newCondition[subKey][subCondition] = convertIfDate(condition[subKey][subCondition]);
}
} else {
newCondition[subKey] = convertIfDate(condition[subKey]);
}
}
return newCondition;
});
} else if (typeof data.$filter.query[key] === 'object' && data.$filter.query[key] !== null) {
// Handle general object conditions
query[key] = {};
for (let condition in data.$filter.query[key]) {
query[key][condition] = convertIfDate(data.$filter.query[key][condition]);
}
} else {
// Handle direct values
query[key] = convertIfDate(data.$filter.query[key]);
}
}
}
if (data.$filter.sort) {

@@ -640,0 +675,0 @@ for (let i = 0; i < data.$filter.sort.length; i++) {

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