Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 56649 invoked from network); 26 Apr 2008 06:02:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Apr 2008 06:02:44 -0000 Received: (qmail 81468 invoked by uid 500); 26 Apr 2008 06:02:46 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 81434 invoked by uid 500); 26 Apr 2008 06:02:46 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 81423 invoked by uid 99); 26 Apr 2008 06:02:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 23:02:45 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jchris@gmail.com designates 72.14.220.157 as permitted sender) Received: from [72.14.220.157] (HELO fg-out-1718.google.com) (72.14.220.157) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Apr 2008 06:02:00 +0000 Received: by fg-out-1718.google.com with SMTP id 22so3783413fge.26 for ; Fri, 25 Apr 2008 23:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=R1Rv2Ozb+3Zb/MWd78dnu7215tUOo3eEvr4UmVm6JmU=; b=Lav1yR/c4XUh8dxQ3cwazQtESEBGw9WaNJS8kzzOgST22dbCxP36GgVKrediVFgbhtV6e+DTv7Gl4+ShFRCIHdmdnacj8XI4PXOQbEINYlrpAyqpZbEfS8ULIhUQcvZNYwCkKORFPNM9xFKnej6lrdXVLDurS9/bdA/QqgkN1KA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=k1RBdkF1plwFp76ESmUsZ4nYDq/p6bw8CUF8G9FFHhOLGLK8GJCdjwgMXgc4n+MxHAp8Mgkxd11yx47aczTay2+XDbhrLtyiYutSzSrKDdlPTPECcNUUDhGzafBD2zjW7YGVW+MV8a5Yt3upT2xpN38LrA4/YEhNUifHUizdOKw= Received: by 10.86.27.9 with SMTP id a9mr2807310fga.62.1209189732694; Fri, 25 Apr 2008 23:02:12 -0700 (PDT) Received: by 10.86.57.13 with HTTP; Fri, 25 Apr 2008 23:02:12 -0700 (PDT) Message-ID: Date: Fri, 25 Apr 2008 23:02:12 -0700 From: "Chris Anderson" Sender: jchris@gmail.com To: couchdb-user@incubator.apache.org Subject: Re: Views In-Reply-To: <0B8FCF82-C889-4BF6-8CF8-AE9040BD76B5@gascard.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <0B8FCF82-C889-4BF6-8CF8-AE9040BD76B5@gascard.net> X-Google-Sender-Auth: 2fe9e9a8adac620d X-Virus-Checked: Checked by ClamAV on apache.org Anthony, http://wiki.apache.org/couchdb/ViewCollation is the way to accomplish tasks like that. Christopher Lenz has a write-up of how to use view collation to sort views, achieving comments grouped by parent blog post. http://www.cmlenz.net/archives/2007/10/couchdb-joins In your case you could index a view with date and type, like this [type, date] and then if you had say 5 types you'd do 5 GET queries against the database, each one fetching only the documents for that day. View collation is one of my favorite things about CouchDB. I'm excited about reduce, because from what I understand, you could use it to lower this to 1 GET, if that's important to you. enjoy, Chris On Fri, Apr 25, 2008 at 9:34 PM, Anthony Mills wrote: > I read most of the documentation, wiki and blogs, but I still do not see how > to accomplish a certain scenario. Hopefully I can describe it adiquitely. > > Lets say I have 1,000,000 documents [all of the same "type"] with a date > attribute. Lets say I want to pick a subset of those documents. How can I > pick those documents of one type that fall on one day? Will I need to get > all 1,000,000 documents? What if I want all documents of one type on one > day that match another attribute? > > I pretty sure this is what map/reduce will help with, but is there a way to > do this now? Can you use more documents to build date relations? > > Also, can you pass more variables than just key to the view function? > > Thank you, > > Anthony > -- Chris Anderson http://jchris.mfdz.com