How can I use several WHERE in my query? Whenever I try to causes an error, I think this should be in the documentation (if forgiveness and I have not found) see:
db.keys.where("name").equalsIgnoreCase('Alice')
.where("age").equalsIgnoreCase(15)
.each(function(fromKEY) {
Uncaught TypeError: db.keys.where(...).equalsIgnoreCase(...).where is not a function
I still think you can use indexes for multiple .where.
What if you check if at least one of .where calls uses indexed field, then query the data, and filter the rest of the fields?
Does that makes sense?
It makes sense in one way, the api would seem a little cleaner. On the other hand, it hides a little of what is actually performant and not. By only offering the where() method on Table and not on Collection, it will be more transparent of how it is optimized in the backend. This way of thinking goes on hand with the vision behind the indexedDB api - that it should be visible for the user whether a query is indexed or not. Unlike SQL, where you don't even need an index but may optimize the code with indexes afterwards, this type of api makes it visible whether an index is being used or not. There are defenitely both pros and cons with that but I have choosed (so far) to let Dexie follow that philosophy and only offer an api that corresponds to what could be done in indexedDB. Choosing another path would make it a little bit more abstract with a complexity burden added to it. Maybe this would be something for an addon.
Ok, I will do this on my own then. Thanks for the answer.
Most helpful comment
See https://groups.google.com/forum/#!topic/dexiejs/G3_W5PssCGA