2014-03-05 30 views
0

再次需要ydn db中的幫助。我有一個對象存儲,其中的對象具有以下屬性:按條件獲取數據的問題

id, published, tempId, sonyId 

我設置公佈,tempId和sonyId的指標:

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

現在我的查詢通過過濾器發佈和sonyId不起作用:

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

我做錯了什麼?如果我從索引中刪除'tempId'比一切工作正常。 我因爲再過添加tempId的指標由tempId獲取方法我呼籲所有條目:

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

}); 

我真的不知道。我做錯了什麼?

非常感謝。

回答

0

你要索引每個查詢如下:

indexes : [{ 
    keyPath : ['published', 'sonyId'] 
}, { 
    keyPath : 'tempId' 
}], 
+0

太好了,謝謝你:-) – Developer89