couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: Complex Keys and Ranges
Date Fri, 11 Jun 2010 15:52:38 GMT
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 <luke.driscoll@gmail.com> 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
>

Mime
View raw message