@cocreate/mongodb 1.17.2 → 1.17.4
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/docs/index.html +0 -4
- package/package.json +1 -1
- package/src/index.js +20 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.17.4](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.3...v1.17.4) (2024-02-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added console.log to temporarily log data[type] that are not arrays ([7fc7e1a](https://github.com/CoCreate-app/CoCreate-mongodb/commit/7fc7e1a4b4e4477b462c48be187fe3b6d416721d))
|
|
7
|
+
|
|
8
|
+
## [1.17.3](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.2...v1.17.3) (2024-02-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Removed https://cdn.cocreate.app/latest/CoCreate.min.css ([8988124](https://github.com/CoCreate-app/CoCreate-mongodb/commit/89881240e2053d6b36bb7950ab3705bea7d1e69f))
|
|
14
|
+
|
|
1
15
|
## [1.17.2](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.1...v1.17.2) (2024-01-30)
|
|
2
16
|
|
|
3
17
|
|
package/docs/index.html
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -717,20 +717,26 @@ function createData(data, array, type, dataTransferedIn, dataTransferedOut) {
|
|
|
717
717
|
let key = '_id'
|
|
718
718
|
if (type !== 'object')
|
|
719
719
|
key = 'name'
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
720
|
+
|
|
721
|
+
// TODO: handle case where data[type] is not an array
|
|
722
|
+
if (!Array.isArray(data[type]))
|
|
723
|
+
console.log('data[type] is not an array', type)
|
|
724
|
+
else {
|
|
725
|
+
for (let i = 0; i < array.length; i++) {
|
|
726
|
+
const matchIndex = data[type].findIndex((item) => item[key] === array[i][key]);
|
|
727
|
+
if (matchIndex !== -1) {
|
|
728
|
+
data[type][matchIndex].$storage.push(array[i].$storage)
|
|
729
|
+
delete array[i].$storage
|
|
730
|
+
data[type][matchIndex].$database.push(array[i].$database)
|
|
731
|
+
delete array[i].$database
|
|
732
|
+
data[type][matchIndex].$array.push(array[i].$array)
|
|
733
|
+
delete array[i].$array
|
|
734
|
+
|
|
735
|
+
// TODO: compare dates and merge and and updates to keep all synced and up to date
|
|
736
|
+
data[type][matchIndex] = { ...data[type][matchIndex], ...array[i] };
|
|
737
|
+
} else
|
|
738
|
+
data[type].push(array[i])
|
|
739
|
+
}
|
|
734
740
|
}
|
|
735
741
|
|
|
736
742
|
return data
|