简体   繁体   中英

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?

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.

Examples:

  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM