Search code examples
javascripttypescriptdexie

Search Dexie Table column for a list of keys


I have a list of keys like this

keys:string[] = [3290, 43827, 5894, 3747]

these keys are unique and they sit in the column 'scheme_codes' of table 'schemes' in IndexDB

I'm using Dexie to query my database I know how to search for a key in a specified column like this

this.table('schemes').where('scheme_codes').equals(3290)

But I couldn't find any resource to search for a list of keys

I have tried this.table.bulkGet([...]), it works but it searches for the key in all of the columns, which is something, I can't gamble with

I could really use your help & Thanks for spending your time for my question


Solution

  • Referring from here, you can do something like:

    this.table('schemes').where('scheme_codes').anyOf([3290, 43827, 5894, 3747])