I have my stores defined like so :
db.version(DB_VERSION).stores({
STATE: 'state',
LOGS: '[timestamp+activity]',
})
This creates a compound index, which is accessed later on like this:
await db.LOGS.where('[timestamp+activity]')
.below(Date.now() - 604800000)
.delete()
However the above snippet gets the compound, whereas I only need to pull out timestamp to run the below
method on. The idea here is to delete indexed items older than a week.
As you are querying the compound index, the argument must be an array of first and second value.
Just change it to:
await db.LOGS.where('[timestamp+activity]')
.below([Date.now() - 604800000, -Infinity])
.delete();