@cocreate/mongodb 1.17.5 → 1.17.6

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.17.6](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.5...v1.17.6) (2024-02-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * process key[] as $push ([5628edf](https://github.com/CoCreate-app/CoCreate-mongodb/commit/5628edf111e46901583fd0ac9fcd5c27687f4204))
7
+
1
8
  ## [1.17.5](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.4...v1.17.5) (2024-02-14)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/mongodb",
3
- "version": "1.17.5",
3
+ "version": "1.17.6",
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",
package/src/index.js CHANGED
@@ -520,6 +520,8 @@ function createUpdate(update, options, data, isGlobal) {
520
520
  options.upsert = data.upsert
521
521
  if (data.$upsert)
522
522
  options.upsert = data.$upsert
523
+ if (data.$update)
524
+ delete data.$update
523
525
 
524
526
  Object.keys(data).forEach(key => {
525
527
  if (isGlobal && !key.startsWith('$') || key === '_id')
@@ -560,6 +562,8 @@ function createUpdate(update, options, data, isGlobal) {
560
562
  }
561
563
  if (!key.startsWith('$'))
562
564
  operator = '$push'
565
+ if (key.endsWith('[]'))
566
+ key = key.replace('[]', '');
563
567
  }
564
568
 
565
569
  let operators = ['$rename', '$inc', '$push', '$each', '$splice', '$unset', '$delete', '$slice', '$pop', '$shift', '$addToSet', '$pull', '$currentDate']