From couchdb-user-return-863-apmail-incubator-couchdb-user-archive=incubator.apache.org@incubator.apache.org Mon Jul 21 09:34:19 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 54983 invoked from network); 21 Jul 2008 09:34:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Jul 2008 09:34:19 -0000 Received: (qmail 10282 invoked by uid 500); 21 Jul 2008 09:34:18 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 10252 invoked by uid 500); 21 Jul 2008 09:34:17 -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 10241 invoked by uid 99); 21 Jul 2008 09:34:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jul 2008 02:34:17 -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 cmlenz@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 21 Jul 2008 09:33:22 +0000 Received: (qmail invoked by alias); 21 Jul 2008 09:32:45 -0000 Received: from vpn.mediatis.de (EHLO [192.168.27.199]) [62.96.5.68] by mail.gmx.net (mp025) with SMTP; 21 Jul 2008 11:32:45 +0200 X-Authenticated: #2618757 X-Provags-ID: V01U2FsdGVkX19NFDpEgPxNdN6KO1KaYKxlBczcVpXvbH6YAUJRyL 6qUbaXKLNs8bHX Message-Id: From: Christopher Lenz To: couchdb-user@incubator.apache.org In-Reply-To: <21BD388E-0F99-4C99-B123-EF4E2D7A9652@gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v926) Subject: Re: Newbie: How to create a View Date: Mon, 21 Jul 2008 11:32:44 +0200 References: <5c02bc4e0807200944h2f2bf82chce107f9f3ac40684@mail.gmail.com> <21BD388E-0F99-4C99-B123-EF4E2D7A9652@gmail.com> X-Mailer: Apple Mail (2.926) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.53 X-Virus-Checked: Checked by ClamAV on apache.org On 20.07.2008, at 19:34, Sho Fukamachi wrote: > as a fellow newbie embarked on a CouchDB crash course I hope I can > help. > > Can you access Futon, the couchdb web interface? If you can, create > a database $MY_DB and switch to it. > > Choose a namespace for your view ($VIEW) (ie just make something > up!). Then create a new document in that database with the name > "_design/$VIEW". > > Futon should now switch to your new document. Create a field in it > called "views". Save. > > Futon is a bit weird about how it presents text editors for fields, > so first put "{}" into the views field and save. Then, double click > it again and you should have a nice big text window. > > Now copy this into the views field: > > { > "get_all": { > "map": "function(doc) { emit(null, doc); }" > } > } > > And save. Actually, it's a bit simpler than that :) 1. If you don't already have a database, create one. 2. Switch the "Custom Query" in the view dropdown at the top right. 3. Type in your query and test/refine it until it does what you want it to do. 4. Click the "Save As" button at the bottom right. 5. In the dialog, enter the design doc ID and the name of the view. 6. You're done. Cheers, -- Christopher Lenz cmlenz at gmx.de http://www.cmlenz.net/