c2-mongoose 2.1.147 → 2.1.149
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 +18 -15
- package/package.json +1 -1
- package/src/flow/SearchFlow.ts +7 -2
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -152,11 +152,10 @@ var SearchFlow = /** @class */ (function () {
|
|
|
152
152
|
return new RegExp("".concat(regexExpression), 'i');
|
|
153
153
|
};
|
|
154
154
|
SearchFlow.prototype.searchNoPageable = function (model, options) {
|
|
155
|
-
var _a;
|
|
156
155
|
return __awaiter(this, void 0, void 0, function () {
|
|
157
|
-
var stagesItems, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result,
|
|
158
|
-
return __generator(this, function (
|
|
159
|
-
switch (
|
|
156
|
+
var stagesItems, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result, _a, _b, populate, _c, resultAux;
|
|
157
|
+
return __generator(this, function (_d) {
|
|
158
|
+
switch (_d.label) {
|
|
160
159
|
case 0:
|
|
161
160
|
stagesItems = [];
|
|
162
161
|
if ((0, Utils_1.isNotEmpty)(options.pipelines)) {
|
|
@@ -170,7 +169,6 @@ var SearchFlow = /** @class */ (function () {
|
|
|
170
169
|
stagesItems.push({ $project: this.projection });
|
|
171
170
|
}
|
|
172
171
|
stagesItems.push({ $sort: this.sort });
|
|
173
|
-
stagesItems.push({ $limit: (_a = this.limit) !== null && _a !== void 0 ? _a : 50 });
|
|
174
172
|
stagesMetadata = [];
|
|
175
173
|
if ((0, Utils_1.isNotEmpty)(options.metadata)) {
|
|
176
174
|
stagesMetadata.push.apply(stagesMetadata, options.metadata);
|
|
@@ -188,20 +186,20 @@ var SearchFlow = /** @class */ (function () {
|
|
|
188
186
|
},
|
|
189
187
|
]).session(options === null || options === void 0 ? void 0 : options.session)];
|
|
190
188
|
case 1:
|
|
191
|
-
result =
|
|
189
|
+
result = _d.sent();
|
|
192
190
|
if (!((0, Utils_1.isNotEmpty)(this.populate) && Array.isArray(this.populate))) return [3 /*break*/, 5];
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
_a = 0, _b = this.populate;
|
|
192
|
+
_d.label = 2;
|
|
195
193
|
case 2:
|
|
196
|
-
if (!(
|
|
197
|
-
populate =
|
|
198
|
-
|
|
194
|
+
if (!(_a < _b.length)) return [3 /*break*/, 5];
|
|
195
|
+
populate = _b[_a];
|
|
196
|
+
_c = result[0];
|
|
199
197
|
return [4 /*yield*/, model.populate(result[0].items, populate)];
|
|
200
198
|
case 3:
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
_c.items = _d.sent();
|
|
200
|
+
_d.label = 4;
|
|
203
201
|
case 4:
|
|
204
|
-
|
|
202
|
+
_a++;
|
|
205
203
|
return [3 /*break*/, 2];
|
|
206
204
|
case 5:
|
|
207
205
|
resultAux = this.transformObject(result[0]);
|
|
@@ -476,7 +474,12 @@ var SearchFlow = /** @class */ (function () {
|
|
|
476
474
|
}
|
|
477
475
|
arr.push(val);
|
|
478
476
|
}
|
|
479
|
-
|
|
477
|
+
if (key.startsWith("notIn")) {
|
|
478
|
+
condition[key] = { $nin: arr };
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
condition[key] = { $in: arr };
|
|
482
|
+
}
|
|
480
483
|
}
|
|
481
484
|
filters.$and.push(condition);
|
|
482
485
|
}
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -149,7 +149,7 @@ abstract class SearchFlow {
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
stagesItems.push({ $sort: this.sort })
|
|
152
|
-
stagesItems.push({ $limit: this.limit ?? 50 })
|
|
152
|
+
// stagesItems.push({ $limit: this.limit ?? 50 })
|
|
153
153
|
|
|
154
154
|
let stagesMetadata: any[] = []
|
|
155
155
|
if (isNotEmpty(options.metadata)) {
|
|
@@ -428,7 +428,12 @@ abstract class SearchFlow {
|
|
|
428
428
|
arr.push(val)
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
|
|
431
|
+
if (key.startsWith("notIn")) {
|
|
432
|
+
condition[key] = { $nin: arr }
|
|
433
|
+
}else{
|
|
434
|
+
condition[key] = { $in: arr }
|
|
435
|
+
}
|
|
436
|
+
|
|
432
437
|
}
|
|
433
438
|
filters.$and.push(condition)
|
|
434
439
|
}
|