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 763C5DB87 for ; Thu, 20 Sep 2012 07:04:45 +0000 (UTC) Received: (qmail 38296 invoked by uid 500); 20 Sep 2012 07:04:43 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 37813 invoked by uid 500); 20 Sep 2012 07:04:39 -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 37764 invoked by uid 99); 20 Sep 2012 07:04:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Sep 2012 07:04:38 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,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.119 as permitted sender) Received: from [17.158.236.119] (HELO nk11p04mm-asmtp010.mac.com) (17.158.236.119) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Sep 2012 07:04:30 +0000 MIME-version: 1.0 Content-type: text/plain; charset=windows-1252 Received: from [192.168.1.64] (host86-165-160-238.range86-165.btcentralplus.com [86.165.160.238]) by nk11p04mm-asmtp010.mac.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Jan 3 2012)) with ESMTPSA id <0MAM0047ZZMU4570@nk11p04mm-asmtp010.mac.com> for user@couchdb.apache.org; Thu, 20 Sep 2012 07:04:09 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855,1.0.431,0.0.0000 definitions=2012-09-19_07:2012-09-19,2012-09-19,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001 definitions=main-1209200000 Subject: Re: Summary view for Pie Charting From: Carl Bourne In-reply-to: <46CC7BBD-5AEC-449A-9F80-68E1AC4BB047@couchbase.com> Date: Thu, 20 Sep 2012 08:04:05 +0100 Content-transfer-encoding: quoted-printable Message-id: <2A199735-20B9-4E24-9EF0-1BE43A649075@me.com> References: <08180A01-8DC0-491C-8976-B75BBB5F95F4@me.com> <46CC7BBD-5AEC-449A-9F80-68E1AC4BB047@couchbase.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1486) Jens, Understand!=20 So I guess then the only way to do this is using 3 separate queries with = startkey, endkey for each time period? Then assemble the results = externally using whatever performed the query? Are there any other options? Regards, Carl On 20 Sep 2012, at 01:18, Jens Alfke wrote: > This isn=92t a valid map function, because it=92s not purely = functional =97 it uses external input in the form of the current = date/time. So if the map function is run twice on the same document, it = will not always emit the same output. That=92s not allowed. >=20 > In other words, think of what happens if you generate the index now, = and then query it 90 days from now. The information in the index = probably won=92t be valid because everything will have expired already, = right? But CouchDB has no idea the index is time-sensitive, so it=92s = going to return you the old data anyway. You just cannot put = time-sensitive data into a map function. >=20 > Instead what you should be doing in the map is writing out the = expiration times of the documents. Then at query time you can see how = far in the future those are. >=20 > =97Jens