@lenne.tech/nest-server 9.0.9 → 9.0.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.10",
|
|
4
4
|
"description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -197,9 +197,9 @@ export abstract class CrudService<T extends CoreModel = any> extends ModuleServi
|
|
|
197
197
|
aggregation.push({ $facet: facet });
|
|
198
198
|
|
|
199
199
|
// Find and process db items
|
|
200
|
-
const dbResult = (await this.mainDbModel.aggregate(aggregation).exec())[0];
|
|
201
|
-
dbResult.totalCount = dbResult.totalCount[0]
|
|
202
|
-
dbResult.items = dbResult.items
|
|
200
|
+
const dbResult = (await this.mainDbModel.aggregate(aggregation).exec())[0] || {};
|
|
201
|
+
dbResult.totalCount = dbResult.totalCount?.[0]?.total || 0;
|
|
202
|
+
dbResult.items = dbResult.items?.map((item) => this.mainDbModel.hydrate(item)) || [];
|
|
203
203
|
return dbResult;
|
|
204
204
|
},
|
|
205
205
|
{ input: filter, outputPath: 'items', serviceOptions }
|