@opra/mongodb 1.6.0 → 1.7.0

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.
@@ -201,7 +201,10 @@ class MongoEntityService extends mongo_service_js_1.MongoService {
201
201
  });
202
202
  /** Execute db command */
203
203
  try {
204
- /** Fetch the cursor and decode the result objects */
204
+ /** Fetch the cursor */
205
+ if (options?.noDecode)
206
+ return cursor.toArray();
207
+ /** Decode result objects */
205
208
  const outputCodec = this._getOutputCodec('find');
206
209
  return (await cursor.toArray()).map((r) => outputCodec(r));
207
210
  }
@@ -269,7 +272,9 @@ class MongoEntityService extends mongo_service_js_1.MongoService {
269
272
  const facetResult = await cursor.toArray();
270
273
  return {
271
274
  count: facetResult[0].count[0]?.totalMatches || 0,
272
- items: facetResult[0].data?.map((r) => outputCodec(r)),
275
+ items: options?.noDecode
276
+ ? facetResult[0].data
277
+ : facetResult[0].data?.map((r) => outputCodec(r)),
273
278
  };
274
279
  }
275
280
  finally {
@@ -198,7 +198,10 @@ export class MongoEntityService extends MongoService {
198
198
  });
199
199
  /** Execute db command */
200
200
  try {
201
- /** Fetch the cursor and decode the result objects */
201
+ /** Fetch the cursor */
202
+ if (options?.noDecode)
203
+ return cursor.toArray();
204
+ /** Decode result objects */
202
205
  const outputCodec = this._getOutputCodec('find');
203
206
  return (await cursor.toArray()).map((r) => outputCodec(r));
204
207
  }
@@ -266,7 +269,9 @@ export class MongoEntityService extends MongoService {
266
269
  const facetResult = await cursor.toArray();
267
270
  return {
268
271
  count: facetResult[0].count[0]?.totalMatches || 0,
269
- items: facetResult[0].data?.map((r) => outputCodec(r)),
272
+ items: options?.noDecode
273
+ ? facetResult[0].data
274
+ : facetResult[0].data?.map((r) => outputCodec(r)),
270
275
  };
271
276
  }
272
277
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/mongodb",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Opra MongoDB adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -10,9 +10,9 @@
10
10
  "valgen": "^5.12.0"
11
11
  },
12
12
  "peerDependencies": {
13
- "@opra/common": "^1.6.0",
14
- "@opra/core": "^1.6.0",
15
- "@opra/http": "^1.6.0",
13
+ "@opra/common": "^1.7.0",
14
+ "@opra/core": "^1.7.0",
15
+ "@opra/http": "^1.7.0",
16
16
  "mongodb": ">= 6.0.0"
17
17
  },
18
18
  "type": "module",
@@ -32,6 +32,7 @@ export declare namespace MongoEntityService {
32
32
  interface FindOneOptions<T> extends MongoService.FindOneOptions<T> {
33
33
  }
34
34
  interface FindManyOptions<T> extends MongoService.FindManyOptions<T> {
35
+ noDecode?: boolean;
35
36
  }
36
37
  interface ReplaceOptions<T> extends MongoService.ReplaceOptions<T> {
37
38
  }