@cocreate/mongodb 1.6.0 → 1.6.2
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/package.json +1 -1
- package/src/index.js +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.6.2](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.6.1...v1.6.2) (2023-08-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* type updated to object ([75313f5](https://github.com/CoCreate-app/CoCreate-mongodb/commit/75313f5c97cc16a7dca993127f4abb6b119fcd3c))
|
|
7
|
+
|
|
8
|
+
## [1.6.1](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.6.0...v1.6.1) (2023-08-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* typo db.array to db.collection ([1561ab9](https://github.com/CoCreate-app/CoCreate-mongodb/commit/1561ab9ad137dcb52575e804ced3659309701550))
|
|
14
|
+
|
|
1
15
|
# [1.6.0](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.5.0...v1.6.0) (2023-08-17)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -185,7 +185,7 @@ function array(action, data) {
|
|
|
185
185
|
[array, value] = array
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const arrayObj = db.
|
|
188
|
+
const arrayObj = db.collection(array);
|
|
189
189
|
|
|
190
190
|
if (action == 'updateCollection') {
|
|
191
191
|
arrayObj.rename(value, function (error, result) {
|
|
@@ -245,28 +245,28 @@ function array(action, data) {
|
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
function createObject(data) {
|
|
248
|
-
return
|
|
248
|
+
return object('createObject', data)
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
function readObject(data) {
|
|
252
|
-
return
|
|
252
|
+
return object('readObject', data)
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
function updateObject(data) {
|
|
256
|
-
return
|
|
256
|
+
return object('updateObject', data)
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
function deleteObject(data) {
|
|
260
|
-
return
|
|
260
|
+
return object('deleteObject', data)
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
function
|
|
263
|
+
function object(action, data) {
|
|
264
264
|
return new Promise(async (resolve, reject) => {
|
|
265
265
|
try {
|
|
266
266
|
const client = await dbClient(data)
|
|
267
267
|
if (!client) return
|
|
268
268
|
|
|
269
|
-
let type = '
|
|
269
|
+
let type = 'object'
|
|
270
270
|
let documents = [];
|
|
271
271
|
|
|
272
272
|
if (data.request)
|
|
@@ -294,7 +294,7 @@ function document(action, data) {
|
|
|
294
294
|
let arraysLength = arrays.length
|
|
295
295
|
for (let array of arrays) {
|
|
296
296
|
const db = client.db(database);
|
|
297
|
-
const arrayObj = db.
|
|
297
|
+
const arrayObj = db.collection(array);
|
|
298
298
|
|
|
299
299
|
let { query, sort } = getFilters(data);
|
|
300
300
|
if (data['organization_id']) {
|