I am trying to figure out how to use a Couchbase N1QL query to return the total amount of documents with a given date over a specific date range and return each date as a row with a second column with the total count.
Example Document
{
"userPk": "43da6438-5a17-4b95-b9cb-993788677675",
"value": "6f916dba-6fa1-42b0-8816-c1e78bdabce5",
"type": 3,
"date": "2017-03-14T12:15:05.4407826-05:00",
"userAgentString": "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko",
}
So, essentially I am looking to run one query that is equal to this:
SELECT COUNT(*) FROM bucket1 WHERE
value= "6f916dba-6fa1-42b0-8816-c1e78bdabce5" AND date = "2017-03-14";
but for a seven day period with the results looking something like this:
Date | Total
------------------
2017-03-14 | 1300
2017-03-13 | 1000
2017-03-12 | 1200
2017-03-11 | 1100
2017-03-10 | 1300
2017-03-09 | 1100
2017-03-08 | 1300
Is this something N1QL is currently capable of doing?