I have searched for this for quite some time but could not get a way to have a where clause with or condition. For example if I have a collection Cars
and I try to do the following:
Cars.where({
model: 1998,
color: 'Black',
make: 'Honda'
})
So what the above will do is search for a car
whose model
is 1998
AND color
is Black
AND make
is Honda
.
But I require a way to get cars
which have either of the three conditions true.
Cars.filter(function(car) {
return car.get("model") === 1998 ||
car.get("color") === "Black" ||
car.get("make") === "Honda";
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With