0

I am developing an web app. Therefore I use Sencha Touch 2 and for ydn db for local storage.

My question is, how can I fetch data from ydn db by 2 or more conditions? For example username=Moo and street = Teststreet and lastname = 'xy'?

Thanks for replies. :-)

2 Answers2

2

Here's I how do it using scan() but hopefully .where().where() will be implemented soon.

var iters, key_range, result, solver;

iters = [];

key_range = ydn.db.KeyRange.only(18);
iters.push(new ydn.db.IndexIterator('person', 'age', key_range));

key_range = ydn.db.KeyRange.only('F');
iters.push(new ydn.db.IndexIterator('person', 'sex', key_range));

result = [];
solver = new ydn.db.algo.NestedLoop(result);    
db.scan(solver, iters).then(function() {
    console.log(result);
});

I based this example from here https://github.com/yathit/ydn-db/blob/master/test/qunit/cursor.js#L929-L943

Hope that helps.

paolooo
  • 4,133
  • 2
  • 18
  • 33
0

Read this doc. Currently it is not easy.

Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83