Querying Couchbase views for dates ranges


#1

Hello,

I need to do a range scan query using a compound key that includes 2 dates, and equivalent of:

select V from T where date1 < D1 and date2 > D2.

I have created a view that has as key [“code”,date1, date2] where date1 and date2 are either a string format like “2015-02-18” of a date format like [[2015,02,18],[2015,02,20]], but I do not manage to write this select query mentioned before (where date 1 = 2015-02-19 and date 2=2015-02-21)
Neither using startKey=[“code”,[0000,00,00], [2015, 02, 21]]&endKey=[“code”, [2015,02,18]] nor using the startKey=[“code”,“0-0-0”, “2015-02- 21”]&endKey=[“code”, “2015-02-18”] works.

Can you please tell me if such a query can be done with views and if yes, what will be the solution.

Thanks