Skip to content

Using anyOf(Empty Array) with or() -> No Result #1607

Description

@hannesthor

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[];

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions