rewrite Filter._getMongoSelecto to not include Empty Filter.

This commit is contained in:
IgnatzHome 2018-05-20 09:33:51 +02:00
parent 4ff8989e8f
commit 39974c9532

View file

@ -248,18 +248,16 @@ Filter = {
const exceptionsSelector = {_id: {$in: this._exceptions}};
this._exceptionsDep.depend();
console.log("Final Filter:");
console.log({
$or: [filterSelector, exceptionsSelector, this.advanced._getMongoSelector()],
});
if (includeEmptySelectors)
return {
$or: [filterSelector, exceptionsSelector, this.advanced._getMongoSelector(), emptySelector],
};
else
return {
$or: [filterSelector, exceptionsSelector, this.advanced._getMongoSelector()],
};
const selectors = [exceptionsSelector];
if (_.any(this._fields, (fieldName) => {
return this[fieldName]._isActive();
})) selectors.push(filterSelector);
if (includeEmptySelectors) selectors.push(emptySelector);
if (this.advanced._isActive()) selectors.push(this.advanced._getMongoSelector());
return {$or: selectors};
},
mongoSelector(additionalSelector) {