IndexedDB - boolean index

boolean, google-chrome, indexeddb, indexing

Solution

Yes, boolean is not a valid key.

If you must, of course you can resolve to 1 and 0.

But it is for good reason. Indexing boolean value is not informative. In your above case, you can do table scan and filter on-the-fly, rather than index query.

Problem

Is it possible to create an index on a Boolean type field? Lets say the schema of the records I want to store is: ``` { id:1, name:"Kris", _dirty:true } ``` I created normal not unique index (onupgradeneeded): ``` ... store.createIndex("dirty","_dirty",{ unique: false }) ... ``` The index is created, but it is empty! - In the index IndexedDB browser there are no records with Boolean values - only Strings, Numbers and Dates or even Arrays. I am using Chrome 25 canary I would like to find all records that have _dirty attribute set to true - do I have to modify _dirty to string or int then?

Original source