c2-mongoose 2.1.281 → 2.1.282
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.
|
@@ -304,7 +304,7 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
304
304
|
var _this = this;
|
|
305
305
|
// Recuperar todos os campos do tipo String
|
|
306
306
|
var camposString = (0, Utils_1.isEmpty)(this.searchTextFields) ? this.extractFieldsOfType(this.model.schema, 'String') : this.searchTextFields;
|
|
307
|
-
var filters = { $and: []
|
|
307
|
+
var filters = { $and: [] };
|
|
308
308
|
Object.entries(objectSearch).forEach(function (_a) {
|
|
309
309
|
var key = _a[0], value = _a[1];
|
|
310
310
|
if ((0, Utils_1.isNotEmpty)(value) || value === null) {
|
|
@@ -362,6 +362,8 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
362
362
|
var key = _a[0], value = _a[1];
|
|
363
363
|
if ((0, Utils_1.isEmpty)(value))
|
|
364
364
|
return;
|
|
365
|
+
if (!filters.$or)
|
|
366
|
+
filters.$or = [];
|
|
365
367
|
if (typeof value === 'string' && _this.isValidObjectId(value) && key !== 'owner') {
|
|
366
368
|
value = new mongoose_1.Types.ObjectId(value);
|
|
367
369
|
}
|
package/package.json
CHANGED
package/src/flow/SearcherFlow.ts
CHANGED
|
@@ -285,7 +285,7 @@ class SearcherFlow<D> {
|
|
|
285
285
|
const camposString = isEmpty(this.searchTextFields) ? this.extractFieldsOfType(this.model.schema, 'String') : this.searchTextFields
|
|
286
286
|
|
|
287
287
|
|
|
288
|
-
let filters = { $and: []
|
|
288
|
+
let filters = { $and: [] } as any
|
|
289
289
|
Object.entries(objectSearch).forEach(([key, value]) => {
|
|
290
290
|
if (isNotEmpty(value) || value === null) {
|
|
291
291
|
if ([
|
|
@@ -347,6 +347,8 @@ class SearcherFlow<D> {
|
|
|
347
347
|
Object.entries(objectSearch?.or).forEach(([key, value]) => {
|
|
348
348
|
if (isEmpty(value)) return
|
|
349
349
|
|
|
350
|
+
if (!filters.$or) filters.$or = []
|
|
351
|
+
|
|
350
352
|
if (typeof value === 'string' && this.isValidObjectId(value as string) && key !== 'owner') {
|
|
351
353
|
value = new Types.ObjectId(value as string)
|
|
352
354
|
}
|