Question

again I need help in ydn db. I have an object store where objects has these attributes:

id, published, tempId, sonyId

I set published, tempId and sonyId to the indexes :

keyPath : 'id',
name : 'XYStore'
indexes : [{ keyPath : ['published', 'sonyId', 'tempId'}]

Now my query to filter by published and sonyId does not work:

db
.from('XYStore')
.where('sonyId, published', '=', ['15', '1'])
.list()
.done(function(records) {
    console.log(records);
});

What did I made wrong? If I remove 'tempId' from indexes than everything works fine. I add tempId to the indexes because in another fetch method I call all entries by tempId:

db
.from('XYStore')
.where('tempId', '=', '8')
.list()
.done(function(records) {

});

I am not really sure. What did I made wrong?

Thanks in advcance.

Was it helpful?

Solution

You have to index each query as follow:

indexes : [{ 
  keyPath : ['published', 'sonyId']
}, {
  keyPath : 'tempId'
}],
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top