@cocreate/crud-server 1.4.0 → 1.4.1
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 +8 -0
- package/CoCreate.config.js +1 -1
- package/docs/index.html +1 -1
- package/package.json +1 -1
- package/src/crud.js +6 -6
- package/src/list.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.4.1](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.4.0...v1.4.1) (2022-05-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* replace ObjectID with ObjectId due to mongodb depreciation ([93e4294](https://github.com/CoCreate-app/CoCreate-crud-server/commit/93e42944447357ec6a244b72ce968bbd8ff5c93d))
|
|
7
|
+
* update config organization_Id to organization_id ([996611b](https://github.com/CoCreate-app/CoCreate-crud-server/commit/996611baf2b2d3afbf895ef193ae15ba7226e77a))
|
|
8
|
+
|
|
1
9
|
# [1.4.0](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.3.4...v1.4.0) (2022-04-01)
|
|
2
10
|
|
|
3
11
|
|
package/CoCreate.config.js
CHANGED
package/docs/index.html
CHANGED
package/package.json
CHANGED
package/src/crud.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {ObjectId} = require("mongodb");
|
|
2
2
|
const {encodeObject, replaceArray} = require("./utils.crud.js")
|
|
3
3
|
|
|
4
4
|
|
|
@@ -30,7 +30,7 @@ class CoCreateCrud {
|
|
|
30
30
|
|
|
31
31
|
collection.insertOne(insertData, function(error, result) {
|
|
32
32
|
if(!error && result){
|
|
33
|
-
const response = {...req_data, document_id: result.
|
|
33
|
+
const response = {...req_data, document_id: `${result.insertedId}`, data: insertData }
|
|
34
34
|
// let isFlat = req_data.isFlat == false ? false : true;
|
|
35
35
|
// const response_data = isFlat ? encodeObject(response) : response;
|
|
36
36
|
// const response_data = response;
|
|
@@ -58,7 +58,7 @@ class CoCreateCrud {
|
|
|
58
58
|
const collection = db.collection(req_data["collection"]);
|
|
59
59
|
|
|
60
60
|
const query = {
|
|
61
|
-
"_id": new
|
|
61
|
+
"_id": new ObjectId(req_data["document_id"])
|
|
62
62
|
};
|
|
63
63
|
if (req_data['organization_id']) {
|
|
64
64
|
query['organization_id'] = req_data['organization_id'];
|
|
@@ -98,10 +98,10 @@ class CoCreateCrud {
|
|
|
98
98
|
try {
|
|
99
99
|
const db = this.dbClient.db(req_data['organization_id']);
|
|
100
100
|
const collection = db.collection(req_data["collection"]);
|
|
101
|
-
let objId = new
|
|
101
|
+
let objId = new ObjectId();
|
|
102
102
|
try {
|
|
103
103
|
if (req_data["document_id"]) {
|
|
104
|
-
objId = new
|
|
104
|
+
objId = new ObjectId(req_data["document_id"]);
|
|
105
105
|
}
|
|
106
106
|
} catch (err) {
|
|
107
107
|
console.log(err);
|
|
@@ -152,7 +152,7 @@ class CoCreateCrud {
|
|
|
152
152
|
const db = this.dbClient.db(req_data['organization_id']);
|
|
153
153
|
const collection = db.collection(req_data["collection"]);
|
|
154
154
|
const query = {
|
|
155
|
-
"_id": new
|
|
155
|
+
"_id": new ObjectId(req_data["document_id"])
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
collection.deleteOne(query, function(error, result) {
|
package/src/list.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {ObjectId} = require("mongodb");
|
|
2
2
|
|
|
3
3
|
class CoCreateList {
|
|
4
4
|
constructor(wsManager, dbClient) {
|
|
@@ -158,7 +158,7 @@ class CoCreateList {
|
|
|
158
158
|
query[key] = {};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
if (item.name == "_id") item.value = item.value.map(v => new
|
|
161
|
+
if (item.name == "_id") item.value = item.value.map(v => new ObjectId(v))
|
|
162
162
|
|
|
163
163
|
switch (item.operator) {
|
|
164
164
|
case '$contain':
|