tanvir alam
tanvir alam

Reputation: 25

How to query CouchDB for date range and item id?

My couchDB document key is like:

["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"].

My question is that, how can I query to this key to get the result between 1-5 date for item id 1.

Upvotes: 0

Views: 311

Answers (1)

seb
seb

Reputation: 818

You will have to reverse the order of the keys and then query the view:

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

Upvotes: 1

Related Questions