我目前正在尝试创建一个视图和查询以适合此SQL查询:
SELECT * FROM articles
WHERE articles.location="NY" OR articles.location="CA"
ORDER BY articles.release_date DESC
Run Code Online (Sandbox Code Playgroud)
我试图用复杂的密钥创建一个视图:
function(doc) {
if(doc.type == "Article") {
emit([doc.location, doc.release_date], doc)
}
}
Run Code Online (Sandbox Code Playgroud)
然后使用startkey和endkey检索一个位置并在发布日期对结果进行排序.
.../_view/articles?startkey=["NY", {}]&endkey=["NY"]&limit=5&descending=true
Run Code Online (Sandbox Code Playgroud)
这很好用.
但是,如何将多个启动键和结束键发送到我的视图以模仿
WHERE articles.location="NY" OR articles.location="CA" ?
couchdb ×1