@cocreate/mongodb 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
- package/src/index.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.3.2](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.3.1...v1.3.2) (2023-05-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* updated dependencies to their latest versions ([adca1c6](https://github.com/CoCreate-app/CoCreate-mongodb/commit/adca1c6046ae3ec00121df74072c46fbaf3082f3))
|
|
7
|
+
|
|
8
|
+
## [1.3.1](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.3.0...v1.3.1) (2023-05-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* $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))
|
|
14
|
+
|
|
1
15
|
# [1.3.0](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.2.5...v1.3.0) (2023-05-19)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/mongodb",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "A simple mongodb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mongodb",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/docs": "^1.
|
|
63
|
-
"@cocreate/hosting": "^1.
|
|
64
|
-
"@cocreate/utils": "^1.
|
|
62
|
+
"@cocreate/docs": "^1.7.11",
|
|
63
|
+
"@cocreate/hosting": "^1.10.3",
|
|
64
|
+
"@cocreate/utils": "^1.20.9",
|
|
65
65
|
"mongodb": "^4.12.1"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/index.js
CHANGED
|
@@ -579,17 +579,18 @@ function createUpdate(data, type) {
|
|
|
579
579
|
delete update['$set']['_id']
|
|
580
580
|
Object.keys(update['$set']).forEach(key => {
|
|
581
581
|
|
|
582
|
-
if (key.includes('[u]'))
|
|
582
|
+
if (key.includes('[u]')) {
|
|
583
583
|
update['$addToSet'] = { [key.replace('[u]', '')]: update['$set'][key] }
|
|
584
|
-
|
|
584
|
+
delete update['$set'][key]
|
|
585
|
+
} else if (key.includes('[]')) {
|
|
585
586
|
if (!Array.isArray(update['$set'][key]))
|
|
586
587
|
update['$set'][key] = [update['$set'][key]]
|
|
587
588
|
|
|
588
589
|
update['$push'] = {
|
|
589
590
|
[key.replace('[]', '')]: { $each: update['$set'][key] }
|
|
590
591
|
}
|
|
592
|
+
delete update['$set'][key]
|
|
591
593
|
}
|
|
592
|
-
delete update['$set'][key]
|
|
593
594
|
// { $push: { "skills": { $each: ["Sports", "Acting"] } } })
|
|
594
595
|
// { $addToSet: { "skills": "GST" } }) // adds "GST"to all arrays if not exist
|
|
595
596
|
projection[key] = 1
|