Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C332EDC07 for ; Sat, 6 Oct 2012 20:08:27 +0000 (UTC) Received: (qmail 41398 invoked by uid 500); 6 Oct 2012 20:08:26 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 41356 invoked by uid 500); 6 Oct 2012 20:08:26 -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 41347 invoked by uid 99); 6 Oct 2012 20:08:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Oct 2012 20:08:26 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of carl.bourne@me.com designates 17.158.236.241 as permitted sender) Received: from [17.158.236.241] (HELO nk11p04mm-asmtp006.mac.com) (17.158.236.241) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Oct 2012 20:08:19 +0000 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Received: from [10.35.212.115] (dab-bas2-h-12-3.dab.02.net [82.132.217.66]) by nk11p04mm-asmtp006.mac.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Jan 3 2012)) with ESMTPSA id <0MBH00GN5MK31X60@nk11p04mm-asmtp006.mac.com> for user@couchdb.apache.org; Sat, 06 Oct 2012 20:07:19 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855,1.0.431,0.0.0000 definitions=2012-10-06_06:2012-10-06,2012-10-06,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001 definitions=main-1210060242 References: <620C985E-E1AC-48C9-8EC4-7C3F42C98FF5@me.com> <8B7BA084-B1C0-46FA-95CA-8065947B8F29@utt.fr> <65464099-C893-4A3F-9466-88298C55A37E@me.com> <8D941ACF-A15F-4651-9F5B-F378E9D5D05B@utt.fr> In-reply-to: <8D941ACF-A15F-4651-9F5B-F378E9D5D05B@utt.fr> Content-transfer-encoding: quoted-printable Message-id: <75098634-1472-45F0-B03D-A8F5C8CA1E94@me.com> Cc: "user@couchdb.apache.org" X-Mailer: iPhone Mail (10A403) From: Carl Bourne Subject: Re: Help with reduce function Date: Sat, 06 Oct 2012 21:07:10 +0100 To: "user@couchdb.apache.org" Thanks again, but I still not quite sure how this would work for me.=20 My documents have expiry dates and I need the ability to build queries that o= nly returns documents that have an expiry date between the startkey and endk= ey parameters.=20 Sorry if I'm being dumb here!=20 Carl Bourne | Senior Sales Engineer | mobile: +44 (0) 7770 284294 | www.vena= fi.com On 6 Oct 2012, at 20:58, Aur=C3=A9lien B=C3=A9nel wr= ote: >> I need the ability to query by date. I don't quite understand what you me= an by your last comment with regards date. Please could you elaborate? >=20 > If your view is like this: > ["UK", 2011, 10, 6, 20, 30] null > ["UK", 2011, 9, 31, 7, 59] null > ["UK", 2012, 10, 6, 21, 31] null > ["USA", 2011, 9, 1, 12, 00] null > ["USA", 2012, 10, 5, 8, 10] null > ["USA", 2012, 10, 6, 20, 03] null > ["USA", 2012, 10, 6, 21, 31] null > ["USA", 2012, 10, 6, 21, 40] null >=20 > You can query it with group_level=3D5 and get: > ["UK", 2011, 10, 6, 20] 1 > ["UK", 2011, 9, 31, 7] 1 > ["UK", 2012, 10, 6, 21] 1 > ["USA", 2011, 9, 1, 12] 1 > ["USA", 2012, 10, 5, 8] 1 > ["USA", 2012, 10, 6, 20] 1 > ["USA", 2012, 10, 6, 21] 2 >=20 > with group_level=3D4: > ["UK", 2011, 10, 6] 1 > ["UK", 2011, 9, 31] 1 > ["UK", 2012, 10, 6] 1 > ["USA", 2011, 9, 1] 1 > ["USA", 2012, 10, 5] 1 > ["USA", 2012, 10, 6] 3 >=20 > with group_level=3D3: > ["UK", 2011, 10] 1 > ["UK", 2011, 9] 1 > ["UK", 2012, 10] 1 > ["USA", 2011, 9] 1 > ["USA", 2012, 10] 4 >=20 > with group_level=3D2: > ["UK", 2011] 2 > ["UK", 2012] 1 > ["USA", 2011] 1 > ["USA", 2012] 4 >=20 > with group_level=3D1: > ["UK"] 3 > ["USA"] 5 >=20 > So to get all of these stats, you just need to split the date into year, m= onth, hour, minute when you emit the key. >=20 >=20 > Regards, >=20 > Aur=C3=A9lien >=20