Why IDBKeyRange.only() does not allow boolean?

1

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"]
javascript
html
indexeddb
asked on Stack Overflow Jul 16, 2013 by Dmitrii Sorin

1 Answer

4

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 .

answered on Stack Overflow Jul 16, 2013 by Myrne Stol • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0