@dnax/core 0.18.9 → 0.19.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.
@@ -4,7 +4,7 @@ import { getCollection } from "../../lib/collection";
4
4
  import { getTenant } from "../../lib/tenant";
5
5
  import type { Actions, Collection, Tenant } from "./../../types/index";
6
6
  import { isArray, omit } from "radash";
7
- import { ClientSession, MongoClient, ObjectId } from "mongodb";
7
+ import { ChangeStream, ClientSession, MongoClient, ObjectId } from "mongodb";
8
8
  import { contextError, fn, toJson, dotJson } from "../../utils";
9
9
  import v, { type Schema } from "joi";
10
10
  import type { Context } from "hono";
@@ -743,6 +743,11 @@ class useRest {
743
743
  return resolve(result);
744
744
  }
745
745
 
746
+ params.$limit = 0;
747
+ params.$project = {
748
+ _id: 1,
749
+ };
750
+
746
751
  result.docs = await this.#tenant.database.db
747
752
  ?.collection(collection)
748
753
  .aggregate(formatData(buildPipeline(params, col)), {
@@ -1603,6 +1608,16 @@ class useRest {
1603
1608
  }
1604
1609
  });
1605
1610
  }
1611
+
1612
+ async stats() {
1613
+ return await this.#tenant.database.db?.stats().then((e) => e);
1614
+ }
1615
+
1616
+ watch(collection: string, pipeline: Array<any>): ChangeStream {
1617
+ return this.#tenant.database.db
1618
+ ?.collection(collection)
1619
+ .watch(pipeline) as ChangeStream;
1620
+ }
1606
1621
  }
1607
1622
 
1608
1623
  const restActivity = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.18.9",
3
+ "version": "0.19.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {