From user-return-10953-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Fri Jun 11 15:53:08 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 72224 invoked from network); 11 Jun 2010 15:53:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Jun 2010 15:53:07 -0000 Received: (qmail 57559 invoked by uid 500); 11 Jun 2010 15:53:06 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 57530 invoked by uid 500); 11 Jun 2010 15:53:06 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 57522 invoked by uid 99); 11 Jun 2010 15:53:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jun 2010 15:53:06 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of robert.newson@gmail.com designates 74.125.82.180 as permitted sender) Received: from [74.125.82.180] (HELO mail-wy0-f180.google.com) (74.125.82.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jun 2010 15:52:58 +0000 Received: by wyg36 with SMTP id 36so1187185wyg.11 for ; Fri, 11 Jun 2010 08:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=8C8JflouvWSWvlMCUD4jF1CsEhKhGbZOwrAzZRP5bKE=; b=sMY13CUcsqIr4lJspl1CcPR8y+zNMTRnE+hv16HAjRuz+Rv9W7Yngbr9/8RglqlS0G P1dkWfdjiYG+mipY4kZP3ov9JA680Wwn3Op1nW2iG3a1Z34Sqdq6ywsFMJT0dqSeQ1Z4 VvbQ/UNUeCZWy8QjTTB/8ZgHDaprGivEYIKK0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=yHyhWESoybfYfXn3wpP7MzeBjBlcYDSNu5A/MzTG4aKL4PqHbNRdII2DSYzeNW5fs/ cXZ2rxXC384OzD43PImiUfaUPFrcTOtVGIRHfzVIITa6dpZ4itq4li/BMy+JUr6I94c2 i3IzVGkkxKbXjlRnaBkSVSqhcaftAKfvKELrw= MIME-Version: 1.0 Received: by 10.216.85.145 with SMTP id u17mr138714wee.84.1276271558360; Fri, 11 Jun 2010 08:52:38 -0700 (PDT) Received: by 10.216.20.136 with HTTP; Fri, 11 Jun 2010 08:52:38 -0700 (PDT) In-Reply-To: References: Date: Fri, 11 Jun 2010 16:52:38 +0100 Message-ID: Subject: Re: Complex Keys and Ranges From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 wr= ote: > 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, mon= th, > user", "year, month, user, platform" and "year, month, user, platform, da= y". > =A0And I didn't want to create multiple views because the data are the sa= me > > Now, when I search for date ranges like this: > startkey =3D [2010, 05, "", "", 1], endkey =3D [2010, 05, "\u9999", "\u99= 99", > 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 =3D [2010, 05, "", 1], endkey =3D [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 >