@dnax/core 0.64.9 → 0.65.1
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.
- package/driver/mongo/rest.ts +16 -5
- package/package.json +1 -1
- package/types/index.ts +3 -0
package/driver/mongo/rest.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ClientSession,
|
|
10
10
|
MongoClient,
|
|
11
11
|
ObjectId,
|
|
12
|
+
type ChangeStreamOptions,
|
|
12
13
|
type FilterOperations,
|
|
13
14
|
} from "mongodb";
|
|
14
15
|
import { contextError, fn, toJson, dotJson, getEntryBykeys } from "../../utils";
|
|
@@ -1062,7 +1063,10 @@ class useRest {
|
|
|
1062
1063
|
collection: string,
|
|
1063
1064
|
id: string,
|
|
1064
1065
|
update: updateParams,
|
|
1065
|
-
options?: Omit<optionCb, "withMeta" | "elementAt" | "withMeta">
|
|
1066
|
+
options?: Omit<optionCb, "withMeta" | "elementAt" | "withMeta"> & {
|
|
1067
|
+
arrayFilters?: Array<object>;
|
|
1068
|
+
upsert?: boolean;
|
|
1069
|
+
}
|
|
1066
1070
|
): Promise<object> {
|
|
1067
1071
|
return new Promise(async (resolve, reject) => {
|
|
1068
1072
|
try {
|
|
@@ -1185,6 +1189,8 @@ class useRest {
|
|
|
1185
1189
|
},
|
|
1186
1190
|
},
|
|
1187
1191
|
{
|
|
1192
|
+
upsert: options?.upsert ?? false,
|
|
1193
|
+
arrayFilters: options?.arrayFilters,
|
|
1188
1194
|
returnDocument: "after",
|
|
1189
1195
|
session: this.#session ? this.#session : undefined,
|
|
1190
1196
|
}
|
|
@@ -2060,10 +2066,15 @@ class useRest {
|
|
|
2060
2066
|
return await this.#tenant.database.db?.stats().then((e) => e);
|
|
2061
2067
|
}
|
|
2062
2068
|
|
|
2063
|
-
watch(
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2069
|
+
watch(
|
|
2070
|
+
collection: string,
|
|
2071
|
+
pipeline: Array<any>,
|
|
2072
|
+
options: ChangeStreamOptions
|
|
2073
|
+
): ChangeStream {
|
|
2074
|
+
return this.#tenant.database.db?.collection(collection).watch(pipeline, {
|
|
2075
|
+
allowDiskUse: true,
|
|
2076
|
+
...options,
|
|
2077
|
+
}) as ChangeStream;
|
|
2067
2078
|
}
|
|
2068
2079
|
}
|
|
2069
2080
|
|
package/package.json
CHANGED