Open AZWN opened 7 years ago
You're right, $and and $or don't work inside filters. As a workaround you can create multiple filters and set the filterOperator
argument to reactiveTable to $and or $or. It won't handle nested ands or ors, but I think it's enough for most use cases.
In our case, we had defined custom filter using a multiple select($or
), among other filters($and
). That case is indeed not possible now. I solved it by joining the selected values with a |, and passing that using the $regex
query.
The Mongo operators
$or
and$and
do not work when set from a custom filter.Example code:
Resulting stacktrace:
Without looking at the code I can imagine that the mongo query generated by the package looks like
{ myFilterField: { $or: selectedValues }
, while you would expect$or: [ { myFilterField: 'val1' }, myFilterField: 'val2' }]
.This might be related to #444