@cocreate/mongodb
Advanced tools
Comparing version
@@ -0,1 +1,8 @@ | ||
## [1.3.1](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.3.0...v1.3.1) (2023-05-19) | ||
### Bug Fixes | ||
* $set keys were deletes due to array handeling function unnecessary keys to reduce clutter and improve efficiency. ([979d873](https://github.com/CoCreate-app/CoCreate-mongodb/commit/979d87391bbac72c65123b665f5b088d19fd5594)) | ||
# [1.3.0](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.2.5...v1.3.0) (2023-05-19) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@cocreate/mongodb", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A simple mongodb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -582,5 +582,6 @@ const { MongoClient, ObjectId } = require('mongodb'); | ||
if (key.includes('[u]')) | ||
if (key.includes('[u]')) { | ||
update['$addToSet'] = { [key.replace('[u]', '')]: update['$set'][key] } | ||
else if (key.includes('[]')) { | ||
delete update['$set'][key] | ||
} else if (key.includes('[]')) { | ||
if (!Array.isArray(update['$set'][key])) | ||
@@ -592,4 +593,4 @@ update['$set'][key] = [update['$set'][key]] | ||
} | ||
delete update['$set'][key] | ||
} | ||
delete update['$set'][key] | ||
// { $push: { "skills": { $each: ["Sports", "Acting"] } } }) | ||
@@ -596,0 +597,0 @@ // { $addToSet: { "skills": "GST" } }) // adds "GST"to all arrays if not exist |
64423
0.62%777
0.13%