@cocreate/mongodb 1.17.4 → 1.17.5

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.5](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.4...v1.17.5) (2024-02-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * $storage,$database, etc. if does not exist set as empty array ([a7d1ae4](https://github.com/CoCreate-app/CoCreate-mongodb/commit/a7d1ae4a277ad2f136963b4e78b6c7ba3826c3ba))
7
+
1
8
  ## [1.17.4](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.3...v1.17.4) (2024-02-13)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/mongodb",
3
- "version": "1.17.4",
3
+ "version": "1.17.5",
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
@@ -725,6 +725,12 @@ function createData(data, array, type, dataTransferedIn, dataTransferedOut) {
725
725
  for (let i = 0; i < array.length; i++) {
726
726
  const matchIndex = data[type].findIndex((item) => item[key] === array[i][key]);
727
727
  if (matchIndex !== -1) {
728
+ if (!data[type][matchIndex].$storage)
729
+ data[type][matchIndex].$storage = []
730
+ if (!data[type][matchIndex].$database)
731
+ data[type][matchIndex].$database = []
732
+ if (!data[type][matchIndex].$array)
733
+ data[type][matchIndex].$array = []
728
734
  data[type][matchIndex].$storage.push(array[i].$storage)
729
735
  delete array[i].$storage
730
736
  data[type][matchIndex].$database.push(array[i].$database)