yathit / ydn-db

Javascript database module for Indexeddb, Web SQL and localStorage storage mechanisms supporting version migration, advanced query, SQL and transaction.
Apache License 2.0
503 stars 41 forks source link

Where() on compount indexes does not work #57

Closed FMCorz closed 9 years ago

FMCorz commented 9 years ago

I have tried several times to query on a compound index without success.

{
  keyPath: ['foo', 'bar']
}

.where(store, ['foo', 'bar'], ...) // Using compound index
.where(store, 'foo, bar', ...)  // Expected name by YDN?
.where(store, 'foo,bar', ...)  // Expected name by YDN?
.where(store, 'foo_bar', ...) // Custom name

With, or without name, lead to no success. Sometimes it appeared that it was working but in fact the where was not filtering anything. I might have done something wrong, but I couldn't debug because the source code was minified and I do not have time to start building the app.

Cheers, Fred

FMCorz commented 9 years ago

Forgot to mention that my workaround was to create an index with a generator using both values. And then doing a search on that index. Not sure if that's a good workaround long term, but that appeared to be working.

yathit commented 9 years ago

Your talking don't not make sense and creating rubbish issues annoying.

Proof your claims in jsbin and read before you do.

If you don't have time to read and understand, this library is not for you.

FMCorz commented 9 years ago

I am sorry if you're considering that my issues are rubish. I have spent hours yesterday trying to get this to work, I have tried to debug the minified JS, I have read everything I could and googled extensively. I will try to provide a code sample, but any help would be appreciated.

yathit commented 9 years ago

From the above documentation,

compound key can be created either by compound index using array keyPath or key itself

So the name of the index does not matter. You give some name and use it. Compound index works in every ways.

mdjnelson commented 8 years ago

Hmm, thanks Fred. Interesting point, however I have to agree - your talking don't not make sense and creating rubbish issues annoying.