@dnax/core 0.8.8 → 0.8.10
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 +9 -6
- package/package.json +1 -1
package/driver/mongo/rest.ts
CHANGED
|
@@ -44,7 +44,7 @@ type optionCb = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
type QueryBatchType<T extends "findOne" | "find"> = {
|
|
47
|
-
as
|
|
47
|
+
as?: string;
|
|
48
48
|
collection: string;
|
|
49
49
|
action: T;
|
|
50
50
|
filter?: {
|
|
@@ -441,19 +441,22 @@ class useRest {
|
|
|
441
441
|
let result = {} as any;
|
|
442
442
|
for await (let query of queries) {
|
|
443
443
|
let resultName = query.as || query.collection;
|
|
444
|
-
if (
|
|
444
|
+
if (
|
|
445
|
+
query.action == "findOne" &&
|
|
446
|
+
(query?.filter?.id || query?.filter?._id)
|
|
447
|
+
) {
|
|
445
448
|
result[resultName] = await this.findOne(
|
|
446
449
|
query.collection,
|
|
447
|
-
query
|
|
448
|
-
query
|
|
450
|
+
query?.filter?.id || query?.filter?._id,
|
|
451
|
+
query?.filter?.params || {},
|
|
449
452
|
query.options
|
|
450
453
|
);
|
|
451
454
|
}
|
|
452
455
|
if (query.action == "find") {
|
|
453
456
|
result[resultName] = await this.find(
|
|
454
457
|
query.collection,
|
|
455
|
-
query
|
|
456
|
-
query
|
|
458
|
+
query?.filter?.params || {},
|
|
459
|
+
query?.options || {}
|
|
457
460
|
);
|
|
458
461
|
}
|
|
459
462
|
}
|