@cocreate/mongodb 1.17.1 → 1.17.3
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 +16 -0
- package/docs/index.html +0 -4
- package/package.json +1 -1
- package/src/index.js +21 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [1.17.3](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.2...v1.17.3) (2024-02-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Removed https://cdn.cocreate.app/latest/CoCreate.min.css ([8988124](https://github.com/CoCreate-app/CoCreate-mongodb/commit/89881240e2053d6b36bb7950ab3705bea7d1e69f))
|
|
7
|
+
|
|
8
|
+
## [1.17.2](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.1...v1.17.2) (2024-01-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* error message ([0344407](https://github.com/CoCreate-app/CoCreate-mongodb/commit/03444076bbc9da8379d8d9a112170ff1c2d416f3))
|
|
14
|
+
* query.organization_id ([1bcbff7](https://github.com/CoCreate-app/CoCreate-mongodb/commit/1bcbff7c57df52aa984b16e1df800d9b3cb0a581))
|
|
15
|
+
* queryData ([e49ab52](https://github.com/CoCreate-app/CoCreate-mongodb/commit/e49ab526bfcd9897f7fb30f578cb142c9c5b0efd))
|
|
16
|
+
|
|
1
17
|
## [1.17.1](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.17.0...v1.17.1) (2024-01-18)
|
|
2
18
|
|
|
3
19
|
|
package/docs/index.html
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { MongoClient, ObjectId } = require('mongodb');
|
|
2
|
-
const { dotNotationToObject,
|
|
2
|
+
const { dotNotationToObject, queryData, searchData, sortData, isValidDate } = require('@cocreate/utils')
|
|
3
3
|
const clients = new Map()
|
|
4
4
|
const organizations = {}
|
|
5
5
|
|
|
@@ -405,6 +405,10 @@ function object(method, data) {
|
|
|
405
405
|
}
|
|
406
406
|
} else if (isFilter) {
|
|
407
407
|
try {
|
|
408
|
+
// TODO: index is 1 if indexeddb already returned an item interfering with query
|
|
409
|
+
// if (data.array === "keys")
|
|
410
|
+
// index = 0
|
|
411
|
+
|
|
408
412
|
if (method === 'read')
|
|
409
413
|
projection = { ...projections, ...projection }
|
|
410
414
|
|
|
@@ -432,7 +436,7 @@ function object(method, data) {
|
|
|
432
436
|
let object = data[type].find(obj => obj._id && obj._id.toString() === document._id.toString())
|
|
433
437
|
if (object) {
|
|
434
438
|
if (object.$storage && object.modified && object.modified.on) {
|
|
435
|
-
if (document && new Date(object.modified.on) > new Date(document.modified.on)) {
|
|
439
|
+
if (document && document.modified && new Date(object.modified.on) > new Date(document.modified.on)) {
|
|
436
440
|
object = { ...document, ...object }
|
|
437
441
|
createUpdate(update, options, object)
|
|
438
442
|
document = await arrayObj.updateOne(query, update, options);
|
|
@@ -651,7 +655,7 @@ async function createFilter(data, arrayObj) {
|
|
|
651
655
|
}
|
|
652
656
|
|
|
653
657
|
if (data['organization_id'])
|
|
654
|
-
query['organization_id'] =
|
|
658
|
+
query['organization_id'] = data['organization_id']
|
|
655
659
|
|
|
656
660
|
return { query, sort, index, limit, count }
|
|
657
661
|
}
|
|
@@ -738,19 +742,23 @@ function getBytes(data) {
|
|
|
738
742
|
}
|
|
739
743
|
|
|
740
744
|
function errorHandler(data, error, database, array) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
+
let errorMessage = typeof error === 'object' && error.message ? error.message : error;
|
|
746
|
+
|
|
747
|
+
let errorObject = {
|
|
748
|
+
message: errorMessage,
|
|
749
|
+
storage: 'mongodb'
|
|
750
|
+
};
|
|
745
751
|
|
|
746
752
|
if (database)
|
|
747
|
-
|
|
753
|
+
errorObject.database = database;
|
|
748
754
|
if (array)
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
755
|
+
errorObject.array = array;
|
|
756
|
+
|
|
757
|
+
if (Array.isArray(data.error)) {
|
|
758
|
+
data.error.push(errorObject);
|
|
759
|
+
} else {
|
|
760
|
+
data.error = [errorObject];
|
|
761
|
+
}
|
|
754
762
|
}
|
|
755
763
|
|
|
756
764
|
module.exports = { send }
|