1

I have read, re-read and read again this document and countless of other sites, but for the life of me I am unable to figure out how to do the following. I simply have the following (ydn notation)

{
    name:'index',
    keyPath:['int1','int2','int3'],
    unique:false,
    multiEntry:false
}

And want to run a query along the lines of

int1=a and int2=b and int3>c and int3<d

Which I believe should be simple enough and if it's not possible in ydn (or too hard) I am fine with a pure indexedDB solution as well (have some experience with indexedDB api's, but can't even find the way to do it with those either). I get how KeyRange works, but I can't find any resources how to combine it with a simple index.

David Mulder
  • 26,123
  • 9
  • 51
  • 114
  • possible duplicate of [In IndexedDB, is there a way to make a sorted compound query?](http://stackoverflow.com/questions/12084177/in-indexeddb-is-there-a-way-to-make-a-sorted-compound-query) – Josh May 22 '14 at 19:31

1 Answers1

1

Prefix key query, as you described above, is very fast and recommended for key-value store filtered query.

You can query as follow:

key_range = IDBKeyRange.bound([a, b, c], [a, b, d], true, true);

or in ydn-db

key_range = ydb.db.KeyRange.bound([a, b, c], [a, b, d], true, true);
Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83
  • The `lower` of a `KeyRange` can be a an array... you gotta be kidding me... well, that does explain the part where I was wondering why it was an `any`. Let's try this :D – David Mulder Feb 15 '14 at 13:23
  • And within that light the compount index section of the docs suddenly make lot's more sense as well :D – David Mulder Feb 15 '14 at 13:24