I want to select values from an Akita store based on 2 properties, either of which should match the thing I'm looking for.
I started with a simple (added the filterBy [] knowing I'd want to filter on more than one thing) :
this.myQuery.selectAll({
filterBy: [
(entity: MyEntityType) => entity.prop1 === thingToMatch
]
}).subscribe((entities) => {})
Which correctly returns entity objects that match the filter. However there are 2 properties onthe entity, either of which may have the value I'm trying to match on. So I took a guess at:
this.myQuery.selectAll({
filterBy: [
(entity: MyEntityType) =>
entity.prop1 === thingToMatch || entity.prop2 === thingToMatch
]
}).subscribe((entities) => {})
The second code block there returns no entities, the first returns matching one ok.
I guess I could do a SelectAll and then use TS filtering,
this.myQuery.selectAll().subscribe((entities) => {
entities.filter(..... )
});
but I was hoping I could do an OR within the Akita select framework.
What is the correct syntax to do an OR operation on an Akita store select? Should I even be using select() at all?