codehooks-js 1.1.10 → 1.1.11

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.
@@ -167,8 +167,7 @@ async function readManyFunc(req, res) {
167
167
  console.log(req.headers['x-real-ip'], req.method, req.originalUrl);
168
168
 
169
169
  const conn = await Datastore.open();
170
-
171
- return (await conn.getMany(collection, mongoQuery)).json(res);
170
+ return (await conn.getMany(collection, mongoQuery.filter, mongoQuery)).json(res);
172
171
  } catch (ex) {
173
172
  console.error(ex.message);
174
173
  res.status(400).send(ex.message);
@@ -266,7 +265,8 @@ async function patchManyFunc(req, res) {
266
265
  console.log(req.headers['x-real-ip'], req.method, req.originalUrl);
267
266
  const conn = await Datastore.open();
268
267
  await _eventHooks.fireBefore(collection, 'PATCH', document);
269
- const result = await conn.updateMany(collection, document, mongoQuery);
268
+ // coll, query, doc, option
269
+ const result = await conn.updateMany(collection, mongoQuery.filter, document, mongoQuery);
270
270
  await _eventHooks.fireAfter(collection, 'PATCH', result);
271
271
  res.json(result);
272
272
  } catch (e) {
@@ -306,7 +306,7 @@ async function deleteManyFunc(req, res) {
306
306
  console.log(req.headers['x-real-ip'], req.method, req.originalUrl);
307
307
  const mongoQuery = _query(req.query, req.headers);
308
308
  const conn = await Datastore.open();
309
- const result = await conn.removeMany(collection, mongoQuery);
309
+ const result = await conn.removeMany(collection, mongoQuery.filter, mongoQuery);
310
310
  res.json(result);
311
311
  } catch (e) {
312
312
  res
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codehooks-js",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "type": "module",
5
5
  "description": "Codehooks.io official library - provides express.JS like syntax",
6
6
  "main": "index.js",