You're not forced to create separate views, though that would let you give them appropriate names.
Instead, you could use a prefix item in your array; ["by_month", doc.month] ["by_month_day", doc.month, doc.day] etc. I think it's equivalent to multiple views, though, since all views in a ddoc are updated together and written to the same file. B. On Fri, Jun 11, 2010 at 5:00 PM, Luke Driscoll <[email protected]> wrote: > I should also add that on second look, where I said: >> However, if I remove the "platform" from the key and search >> startkey = [2010, 05, "", 1], endkey = [2010, 05, "\u9999", 12] >> it works as expected. > > I was, in fact, wrong. > > On Fri, Jun 11, 2010 at 11:57, Luke Driscoll <[email protected]>wrote: > >> Thanks Bob, I thought it was going to be something like that. I'll have to >> create separate views for this then. >> >> >> On Fri, Jun 11, 2010 at 11:52, Robert Newson <[email protected]>wrote: >> >>> You can only query contiguous ranges of keys with startkey/endkey. >>> >>> [2010, 05, "", "", 13] is lower than [2010, 05, "\u9999", "\u9999", >>> 12] and is therefore included. >>> >>> B. >>> >>> On Fri, Jun 11, 2010 at 4:46 PM, Luke Driscoll <[email protected]> >>> wrote: >>> > All, >>> > I'm sorry if this question has been answered before, but I took a look >>> at >>> > the archives and couldn't find the answer that quite covers it. >>> > >>> > I have a complex key of >>> > [year, month, "user name", "platform", day] >>> > >>> > The reason that I did it this way (put day at the end) is because I need >>> to >>> > be able to reduce to a group level of "year, month" as well as "year, >>> month, >>> > user", "year, month, user, platform" and "year, month, user, platform, >>> day". >>> > And I didn't want to create multiple views because the data are the >>> same >>> > >>> > Now, when I search for date ranges like this: >>> > startkey = [2010, 05, "", "", 1], endkey = [2010, 05, "\u9999", >>> "\u9999", >>> > 12] >>> > it gives me the results for the whole of May, rather than just the first >>> > twelve days. >>> > >>> > However, if I remove the "platform" from the key and search >>> > startkey = [2010, 05, "", 1], endkey = [2010, 05, "\u9999", 12] >>> > it works as expected. >>> > >>> > Can you give me some pointers as to what I'm doing wrong, or give me >>> some >>> > suggestions as to how to do this better. >>> > >>> > Thanks in advance, >>> > Luke >>> > >>> >> >> >
