如果我是做一個GET請求,我會做一些事情,如:如何查詢pouchDB中的複雜鍵?
https://myserver.com/sometestdb/_design/sortJob/_view/index?limit=100&reduce=false&startkey = 「job_price」] & endkey = 「job_price」,{}]
對於地圖查詢,如:
function(doc) {
if (doc.data.type === "job") {
emit(["job_ref", doc.data.ref], null);
emit(["job_price", doc.data.price], null);
}
}
我將如何複製使用pouchDb query查詢?我已經試過周圍的開始和結束鍵,但沒有運氣的幾件事情:
{
include_docs: true,
startkey: 'job_price',
endkey: 'job_price,{}'
}
{
include_docs: true,
startkey: 'job_price',
endkey: 'job_price\uffff'
}
這些都返回0的結果,而我用的鏈接會產生預期的結果。
注意:我可以確認數據存在於我的pouchDB中,因爲我使用pouch-find
插件查詢了它,但我嘗試使用各種技術來查看哪個更快。
編輯:根據該文檔的complex keys section,我應該能夠做到以下幾點:
{
include_docs: true,
startkey: '[\'job_price\']',
endkey: '[\'job_price\',{}]'
}
但是,其結果是:
沒有行可以匹配你的鍵程,反向你的start_key和end_key 或設置{降序:true}
但我應該可以得到像這樣的結果,不想要descending: true
。