How flexible are CouchDB MapReduce views?

If I have a Cloudant MapReduce view with year/month/day as the key array, can I query the dataset just by month or just by day?

1 answer

  • answered 2022-05-04 10:28 Daniel Mermelstein

    No. You can query by y/m/d or by y/m or by y. In other words, you are allowed to omit fields, but you cannot have gaps, so you have to start omitting from the right.


    • Querying by y/m/d -- key=[2022,5,20] finds everything for one day
    • Querying by y/m -- startkey=[2022,1]&endkey=[2022,2] finds everything in January
    • Querying by y -- startkey=[2021]&endkey=[2022] finds everything in 2021

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum