如何查询CouchDB的日期范围和项目ID?

时间:2016-06-01 12:46:48

标签: couchdb

我的couchDB文档密钥如下:

["2016-05-01","1"],
["2016-05-02","2"],
["2016-05-03","1"],
["2016-05-04","2"],
["2016-05-04","1"],
["2016-05-05","1"],
["2016-05-05","6"].

我的问题是,如何查询此键以在项目ID 1的1-5日期之间获得结果。

1 个答案:

答案 0 :(得分:1)

您必须反转键的顺序,然后查询视图:

http://......../view?startkey=[1,"2016-05-01"]&endkey=[1,"2016-05-05"]