Question

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.

Was it helpful?

Solution

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top