Thanks again, but I still not quite sure how this would work for me. My documents have expiry dates and I need the ability to build queries that only returns documents that have an expiry date between the startkey and endkey parameters.
Sorry if I'm being dumb here! Carl Bourne | Senior Sales Engineer | mobile: +44 (0) 7770 284294 | www.venafi.com On 6 Oct 2012, at 20:58, Aurélien Bénel <[email protected]> wrote: >> I need the ability to query by date. I don't quite understand what you mean >> by your last comment with regards date. Please could you elaborate? > > If your view is like this: > ["UK", 2011, 10, 6, 20, 30] null > ["UK", 2011, 9, 31, 7, 59] null > ["UK", 2012, 10, 6, 21, 31] null > ["USA", 2011, 9, 1, 12, 00] null > ["USA", 2012, 10, 5, 8, 10] null > ["USA", 2012, 10, 6, 20, 03] null > ["USA", 2012, 10, 6, 21, 31] null > ["USA", 2012, 10, 6, 21, 40] null > > You can query it with group_level=5 and get: > ["UK", 2011, 10, 6, 20] 1 > ["UK", 2011, 9, 31, 7] 1 > ["UK", 2012, 10, 6, 21] 1 > ["USA", 2011, 9, 1, 12] 1 > ["USA", 2012, 10, 5, 8] 1 > ["USA", 2012, 10, 6, 20] 1 > ["USA", 2012, 10, 6, 21] 2 > > with group_level=4: > ["UK", 2011, 10, 6] 1 > ["UK", 2011, 9, 31] 1 > ["UK", 2012, 10, 6] 1 > ["USA", 2011, 9, 1] 1 > ["USA", 2012, 10, 5] 1 > ["USA", 2012, 10, 6] 3 > > with group_level=3: > ["UK", 2011, 10] 1 > ["UK", 2011, 9] 1 > ["UK", 2012, 10] 1 > ["USA", 2011, 9] 1 > ["USA", 2012, 10] 4 > > with group_level=2: > ["UK", 2011] 2 > ["UK", 2012] 1 > ["USA", 2011] 1 > ["USA", 2012] 4 > > with group_level=1: > ["UK"] 3 > ["USA"] 5 > > So to get all of these stats, you just need to split the date into year, > month, hour, minute when you emit the key. > > > Regards, > > Aurélien >
