我正在使用CouhDB 1.1 - 我正在尝试:
SELECT doc.data WHERE doc._id="c" order by doc.date
我有以下3个文档:
{
"_id": "c",
"_rev": "7-4193c63ab034214ff5514006ac1143b2",
"data": "c",
"date": "2009/01/01"
}
{
"_id": "b",
"_rev": "3-9200b985d55a8f778d9726d6f1e9dbe0",
"data": "b",
"date": "2010/01/01"
}
{
"_id": "a",
"_rev": "4-2834579ebc10e0467191bf9c8f115b60",
"data": "a",
"date": "2011/01/01"
}
以下视图来查询它:
function(doc) {
emit([doc.data, doc.date], doc._id);
}
我发送以下查询:
http://localhost:5984/tryme/_design/view/_view/data?key=[{},"c"]&descending=true
返回0个文档
和
http://localhost:5984/tryme/_design/view/_view/data?startkey=[{},"c"]&descending=true
返回所有文档...
我假设这应该有效,基于此:translate this mysql into a couchdb view?
由于 - 萨米