@cocreate/mongodb 1.1.1 → 1.1.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 +15 -0
- package/package.json +4 -6
- package/src/index.js +13 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.1.3](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.1.2...v1.1.3) (2022-12-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* removed un used devDependencies ([9464256](https://github.com/CoCreate-app/CoCreate-mongodb/commit/94642566c03fba94932903d29e6b92a4a7a3f03d))
|
|
7
|
+
|
|
8
|
+
## [1.1.2](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.1.1...v1.1.2) (2022-12-13)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* bump dependencies ([fcf95de](https://github.com/CoCreate-app/CoCreate-mongodb/commit/fcf95de70fbfeba97f4d313ed0b8134a4496cca2))
|
|
14
|
+
* supports operator includes and $includes ([d63e4a4](https://github.com/CoCreate-app/CoCreate-mongodb/commit/d63e4a48cba168955b71430c6a7a465849388cc0))
|
|
15
|
+
|
|
1
16
|
## [1.1.1](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.1.0...v1.1.1) (2022-12-12)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/mongodb",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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",
|
|
@@ -51,9 +51,7 @@
|
|
|
51
51
|
"babel-loader": "^8.1.0",
|
|
52
52
|
"clean-webpack-plugin": "^3.0.0",
|
|
53
53
|
"file-loader": "^6.2.0",
|
|
54
|
-
"html-webpack-plugin": "^4.5.0",
|
|
55
54
|
"mini-css-extract-plugin": "^1.5.0",
|
|
56
|
-
"style-loader": "^2.0.0",
|
|
57
55
|
"terser-webpack-plugin": "^5.1.1",
|
|
58
56
|
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
59
57
|
"webpack": "^5.24.4",
|
|
@@ -61,9 +59,9 @@
|
|
|
61
59
|
"webpack-log": "^3.0.1"
|
|
62
60
|
},
|
|
63
61
|
"dependencies": {
|
|
64
|
-
"@cocreate/docs": "^1.4.
|
|
65
|
-
"@cocreate/hosting": "^1.6.
|
|
66
|
-
"@cocreate/utils": "^1.16.
|
|
62
|
+
"@cocreate/docs": "^1.4.19",
|
|
63
|
+
"@cocreate/hosting": "^1.6.18",
|
|
64
|
+
"@cocreate/utils": "^1.16.2",
|
|
67
65
|
"mongodb": "^4.12.1"
|
|
68
66
|
}
|
|
69
67
|
}
|
package/src/index.js
CHANGED
|
@@ -622,10 +622,17 @@ function getFilters(data) {
|
|
|
622
622
|
query = createQuery(filter.query);
|
|
623
623
|
|
|
624
624
|
|
|
625
|
-
if (filter.sort)
|
|
626
|
-
for (let i = 0; i < filter.sort.length; i++)
|
|
627
|
-
|
|
625
|
+
if (filter.sort) {
|
|
626
|
+
for (let i = 0; i < filter.sort.length; i++) {
|
|
627
|
+
let direction = filter.sort[i].direction
|
|
628
|
+
if (direction == 'desc' || direction == -1)
|
|
629
|
+
direction = -1;
|
|
630
|
+
else
|
|
631
|
+
direction = 1;
|
|
628
632
|
|
|
633
|
+
sort[filter.sort[i].name] = filter.sort[i].direction
|
|
634
|
+
}
|
|
635
|
+
}
|
|
629
636
|
return {query, sort}
|
|
630
637
|
}
|
|
631
638
|
|
|
@@ -647,6 +654,7 @@ function createQuery(filters) {
|
|
|
647
654
|
|
|
648
655
|
switch (item.operator) {
|
|
649
656
|
case '$includes':
|
|
657
|
+
case 'includes':
|
|
650
658
|
query[key]['$regex'] = item.value;
|
|
651
659
|
break;
|
|
652
660
|
|
|
@@ -660,6 +668,8 @@ function createQuery(filters) {
|
|
|
660
668
|
}
|
|
661
669
|
break;
|
|
662
670
|
|
|
671
|
+
case 'equals':
|
|
672
|
+
query[$eq][item.operator] = item.value;
|
|
663
673
|
case '$eq':
|
|
664
674
|
case '$ne':
|
|
665
675
|
case '$lt':
|