Passing an empty array to anyOf in combination with an or() will result in an empty result set, even though the "or" condition has matches. There are workarounds but they make the code awkward.
Example query:
const facilityTypeIds = await this.db.FacilityType.where("description").startsWithIgnoreCase(searchString).primaryKeys();
facilities = (await this.db.Facility
.where("number").startsWithIgnoreCase(searchString)
.or("facilityName").startsWithIgnoreCase(searchString)
.or("facilityTypeId").anyOf(facilityTypeIds)
.offset(first).limit(recordCount).toArray()) as Facility[];
Passing an empty array to anyOf in combination with an or() will result in an empty result set, even though the "or" condition has matches. There are workarounds but they make the code awkward.
Example query:
const facilityTypeIds = await this.db.FacilityType.where("description").startsWithIgnoreCase(searchString).primaryKeys();
facilities = (await this.db.Facility
.where("number").startsWithIgnoreCase(searchString)
.or("facilityName").startsWithIgnoreCase(searchString)
.or("facilityTypeId").anyOf(facilityTypeIds)
.offset(first).limit(recordCount).toArray()) as Facility[];