@dnax/core 0.1.10 → 0.1.12

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.
@@ -171,7 +171,7 @@ class useRest {
171
171
 
172
172
  result.docs = await this.#tenant.database.db
173
173
  ?.collection(collection)
174
- .aggregate(pipeline, {
174
+ .aggregate(formatData(pipeline), {
175
175
  allowDiskUse: true,
176
176
  })
177
177
  .toArray();
@@ -812,33 +812,32 @@ class useRest {
812
812
  });
813
813
  }
814
814
 
815
- if (typeof id == "string") {
816
- result.doc = await this.#tenant.database.db
817
- ?.collection(collection)
818
- .findOneAndUpdate(
819
- {
820
- ...(formatData(filter) || {}),
821
- },
822
- {
823
- ...formatData(omit(update, omitUpdate)),
824
- $currentDate: {
825
- updatedAt: true,
826
- },
815
+ result.doc = await this.#tenant.database.db
816
+ ?.collection(collection)
817
+ .findOneAndUpdate(
818
+ {
819
+ ...(formatData(filter) || {}),
820
+ },
821
+ {
822
+ ...formatData(omit(update, omitUpdate)),
823
+ $currentDate: {
824
+ updatedAt: true,
827
825
  },
828
- {
829
- upsert: true,
830
- returnDocument: "after",
831
- session: this.#session ? this.#session : undefined,
832
- }
833
- );
834
- }
826
+ },
827
+ {
828
+ upsert: true,
829
+ returnDocument: "after",
830
+
831
+ session: this.#session ? this.#session : undefined,
832
+ }
833
+ );
835
834
 
836
835
  if (col?.hooks?.afterUpdate && useHook) {
837
836
  await col.hooks.afterUpdate({
838
837
  sharedData: sharedData,
839
838
  c: this.#c,
840
839
  driver: "mongodb",
841
- id: id,
840
+ filter: filter,
842
841
  action: "updateOne",
843
842
  update: update,
844
843
  session: sessionStorage(),
@@ -1037,6 +1036,7 @@ class useRest {
1037
1036
  sharedData: sharedData,
1038
1037
  id: id,
1039
1038
  c: this.#c,
1039
+ io: Cfg.io,
1040
1040
  driver: "mongodb",
1041
1041
  action: "deleteOne",
1042
1042
  session: sessionStorage(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {