@pi-r/mongodb 0.9.5 → 0.9.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
@@ -271,7 +271,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
271
271
  }
272
272
  for (let i = 0; i < length; ++i) {
273
273
  const item = batch[i];
274
- const { source, name, table, id, aggregate, sort, cacheObjectKey, ignoreCache } = item;
274
+ const { source, name, table, id, aggregate, sort, ignoreCache } = item;
275
275
  let { query, update, streamRow, limit = 0 } = item;
276
276
  if (!table) {
277
277
  const error = (0, types_1.errorMessage)(source, "Missing database table");
@@ -300,10 +300,10 @@ async function executeBatchQuery(batch, options = '', outResult) {
300
300
  streamRow = (0, types_1.asFunction)(streamRow);
301
301
  }
302
302
  let queryString = '', rows, pipeline;
303
- if (caching && ignoreCache !== true && (!targetObject || typeof cacheObjectKey === 'string') && !streamRow) {
303
+ if (caching && ignoreCache !== true && !streamRow) {
304
304
  const collection = item.client?.collection;
305
305
  const db = item.client?.db;
306
- queryString = (name || '') + '_' + table + (sort ? '_' + Db.asString(sort, true) : '') + '_' + (limit > 0 ? limit.toString() : '0') + (db ? Db.asString(db, true) : '') + (collection ? Db.asString(collection, true) : '') + (targetObject ? targetObject.toString() + cacheObjectKey : '');
306
+ queryString = (name || '') + '_' + table + (sort ? '_' + Db.asString(sort, true) : '') + '_' + (limit > 0 ? limit.toString() : '0') + (db ? Db.asString(db, true) : '') + (collection ? Db.asString(collection, 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.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "MongoDB client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",
@@ -20,9 +20,9 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
22
  "dependencies": {
23
- "@e-mc/db": "^0.11.17",
24
- "@e-mc/request": "^0.11.17",
25
- "@e-mc/types": "^0.11.17",
23
+ "@e-mc/db": "^0.11.18",
24
+ "@e-mc/request": "^0.11.18",
25
+ "@e-mc/types": "^0.11.18",
26
26
  "mongodb": "^6.15.0"
27
27
  }
28
28
  }