Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why IDBKeyRange.only() does not allow boolean?

I have an index in my object store, created like this:

objStore.createIndex("pinned", "pinned");

I want to store values of boolean type there. And unfortunately I can't get only records with "pinned" field set to "true". Why does this happen? Is this my database design mistake?

IDBKeyRange.only(true)
Firefox: [Exception... "Data provided to an operation does not meet requirements."  code: "0" nsresult: "0x80660005 (DataError)"  location: "Web Console Line: 1"]
like image 228
Dmitrii Sorin Avatar asked Dec 30 '25 18:12

Dmitrii Sorin


1 Answers

In IndexedDB, a boolean value is not a valid key. See http://www.w3.org/TR/IndexedDB/#dfn-valid-key

I found this at IndexedDB - boolean index .

like image 160
Myrne Stol Avatar answered Jan 02 '26 09:01

Myrne Stol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!