Why IDBKeyRange.only() does not allow boolean?

html, indexeddb, javascript

Solution

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 .

Problem

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"] ```

Original source