@pi-r/mongodb 0.8.5 → 0.8.6

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.
Files changed (2) hide show
  1. package/client/index.js +5 -5
  2. package/package.json +4 -4
package/client/index.js CHANGED
@@ -270,7 +270,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
270
270
  }
271
271
  for (let i = 0; i < length; ++i) {
272
272
  const item = batch[i];
273
- const { source, name, table, id, aggregate, sort, client, cacheObjectKey, ignoreCache } = item;
273
+ const { source, name, table, id, aggregate, sort, client, ignoreCache } = item;
274
274
  let { query, update, streamRow, limit = 0 } = item;
275
275
  if (!table) {
276
276
  const error = (0, types_1.errorMessage)(source, "Missing database table");
@@ -302,8 +302,8 @@ async function executeBatchQuery(batch, options = '', outResult) {
302
302
  streamRow = coercing && (0, types_1.asFunction)(streamRow);
303
303
  }
304
304
  let queryString = '', rows, pipeline;
305
- if (caching && ignoreCache !== true && (!targetObject || typeof cacheObjectKey === 'string') && !streamRow) {
306
- queryString = (name || '') + '_' + table + '_' + limit + Db.asString(sort, true) + Db.asString(client, true) + (targetObject ? targetObject.toString() + cacheObjectKey : '');
305
+ if (caching && ignoreCache !== true && !streamRow) {
306
+ queryString = (name || '') + '_' + table + '_' + limit + Db.asString(sort, true) + Db.asString(client, true) + (targetObject && typeof item.cacheObjectKey === 'string' ? targetObject.toString() + item.cacheObjectKey : '');
307
307
  }
308
308
  if (aggregate) {
309
309
  pipeline = Array.isArray(aggregate) ? aggregate : aggregate.pipeline;
@@ -314,7 +314,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
314
314
  }
315
315
  if (queryString) {
316
316
  const setResult = () => {
317
- if (ignoreCache !== 1 && (rows = this.getQueryResult(source, DbPool.sanitize(credential), queryString, cacheValue))) {
317
+ if (ignoreCache !== 1 && (rows = this.getQueryResult(source, DbPool.sanitize(mongoCredential || credential), queryString, cacheValue))) {
318
318
  ++mongoCache;
319
319
  if (parallel) {
320
320
  tasks[i] = Promise.resolve(rows);
@@ -333,7 +333,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
333
333
  continue;
334
334
  }
335
335
  }
336
- else if (!aggregate && setResult()) {
336
+ else if (!aggregate && !update && setResult()) {
337
337
  continue;
338
338
  }
339
339
  if (!ignoreCache && outCacheMiss) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/mongodb",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "MongoDB client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",
@@ -21,9 +21,9 @@
21
21
  "license": "MIT",
22
22
  "homepage": "https://github.com/anpham6/pi-r#readme",
23
23
  "dependencies": {
24
- "@e-mc/db": "^0.10.20",
25
- "@e-mc/request": "^0.10.20",
26
- "@e-mc/types": "^0.10.20",
24
+ "@e-mc/db": "^0.10.21",
25
+ "@e-mc/request": "^0.10.21",
26
+ "@e-mc/types": "^0.10.21",
27
27
  "mongodb": "^6.9.0"
28
28
  }
29
29
  }