c2-mongoose 2.1.62 → 2.1.63
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/dist/flow/SearchFlow.js
CHANGED
|
@@ -121,7 +121,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
121
121
|
};
|
|
122
122
|
SearchFlow.prototype.buildProjections = function () {
|
|
123
123
|
if (!Array.isArray(this.select)) {
|
|
124
|
-
return
|
|
124
|
+
return undefined;
|
|
125
125
|
}
|
|
126
126
|
var projection = {};
|
|
127
127
|
for (var _i = 0, _a = this.select; _i < _a.length; _i++) {
|
|
@@ -168,7 +168,8 @@ var SearchFlow = /** @class */ (function () {
|
|
|
168
168
|
{ $match: this.filters },
|
|
169
169
|
{ $sort: this.sort },
|
|
170
170
|
{ $skip: (this.page - 1) * this.limit },
|
|
171
|
-
{ $limit: this.limit }
|
|
171
|
+
{ $limit: this.limit },
|
|
172
|
+
this.projection ? { $project: this.projection } : { $addFields: {} }
|
|
172
173
|
], options.pipelines, true);
|
|
173
174
|
return [4 /*yield*/, model.aggregate([
|
|
174
175
|
{
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -49,7 +49,7 @@ abstract class SearchFlow {
|
|
|
49
49
|
|
|
50
50
|
buildProjections() {
|
|
51
51
|
if (!Array.isArray(this.select)) {
|
|
52
|
-
return
|
|
52
|
+
return undefined
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
let projection: { [key: string]: number } = {}
|
|
@@ -95,7 +95,7 @@ abstract class SearchFlow {
|
|
|
95
95
|
{ $sort: this.sort },
|
|
96
96
|
{ $skip: (this.page - 1) * this.limit },
|
|
97
97
|
{ $limit: this.limit },
|
|
98
|
-
|
|
98
|
+
this.projection ? { $project: this.projection } : { $addFields: {} },
|
|
99
99
|
...options.pipelines
|
|
100
100
|
]
|
|
101
101
|
|