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 011106437 for ; Mon, 16 May 2011 07:37:28 +0000 (UTC) Received: (qmail 47176 invoked by uid 500); 16 May 2011 07:37:26 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 46577 invoked by uid 500); 16 May 2011 07:37:21 -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 46569 invoked by uid 99); 16 May 2011 07:37:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2011 07:37:18 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rgabo@rgabostyle.com designates 209.85.161.52 as permitted sender) Received: from [209.85.161.52] (HELO mail-fx0-f52.google.com) (209.85.161.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2011 07:37:12 +0000 Received: by fxm6 with SMTP id 6so4499508fxm.11 for ; Mon, 16 May 2011 00:36:51 -0700 (PDT) Received: by 10.223.71.193 with SMTP id i1mr3831328faj.140.1305531410176; Mon, 16 May 2011 00:36:50 -0700 (PDT) Received: from newyork.local (catv-86-101-12-129.catv.broadband.hu [86.101.12.129]) by mx.google.com with ESMTPS id d16sm513538faa.12.2011.05.16.00.36.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 May 2011 00:36:49 -0700 (PDT) Date: Mon, 16 May 2011 09:36:48 +0200 From: Gabor Ratky To: user@couchdb.apache.org Message-ID: In-Reply-To: References: <0FE69EE5-B262-49E0-934C-AACBF0CB2242@sri.com> <746D5AC7-6D03-4865-A6AC-F8F4E9684D63@sri.com> Subject: Re: fetching data: how to filter? X-Mailer: sparrow 1.1.1 (build 685) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="4dd0d410_62bbd95a_74b0" Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org --4dd0d410_62bbd95a_74b0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Disposition: inline Alex, as with everyone new to CouchDB (and/or NoSQL) I recommend going through the CouchDB: Definitive Guide [1]. It is an indispensable resource and gives you a great overview of CouchDB. It makes it much easier to understand the concepts and the design behind CouchDB. Afterwards, you can just refer to the CouchDB Wiki [2] or the HTTP API Reference in the new Techzone by Couchbase [3]. Have fun with Couch! Gabor [1] http://guide.couchdb.org/ [2] http://wiki.apache.org/couchdb/ [3] http://techzone.couchbase.com/sites/default/files/uploads/all/documentation/couchbase-api.html On Monday, May 16, 2011 at 12:29 AM, Alexander Gabriel wrote: That is very helpful and answers my questions. > Thanks for taking so much time. Your effort is very much appreciated! > > Alexander Gabriel > > > > > 2011/5/16 Jim Klo > > > > > To understand views: > > http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views > > > > A map function might look like: > > > > function (doc) { > > > > if (doc.Typ) { > > emit(doc.Typ, null); > > } > > > > } > > > > > > then to query the view: > > > > curl -X GET " > > http://localhost:5981/dbname/_design/docname/_view/viewname?key=%22Beobachtung%22&include_docs=true > > > > See http://wiki.apache.org/couchdb/HTTP_view_API for details on querying > > views and other options. > > > > > > > > * > > Jim Klo > > Senior Software Engineer > > Center for Software Engineering > > SRI International > > * > > > > > > > > > > On May 15, 2011, at 2:18 PM, Alexander Gabriel wrote: > > > > thanks a lot for your help. So I can define a view that includes the Typ > > field and filter for it. > > But how do I fetch the data from the view using curl? > > > > Using a list seems like more work. > > > > Alexander Gabriel > > > > > > > > > > 2011/5/15 Jim Klo > > > > You need to define a view, using the name as at least part of the key or > > > > create a list. Then you can filter using the key in a view or some > > parameter > > > > you pass using a list. > > > > > > I suggest taking a look a Max Ogden's talk on CouchDB. It's a great > > > > jumpstart for a newbie. > > > > > > http://vimeo.com/18808177 > > > > > > - Jim > > > > > > > > On May 15, 2011, at 1:34 PM, Alexander Gabriel wrote: > > > > > > Hi > > > > I want to fetch documents from a CouchDb named evab. The documents > > > > include a > > > > field "Typ" and I want to fetch those with Typ = Beobachtung. > > > > > > So far I've tried: > > > > > > - curl -d "{\"Typ\":\"Beobachtung\"}" -X POST > > > > > > > > http://username:secretpassword@127.0.0.1:5984/evab/_bulk_docs?include_docs=true > > > > > > Beobachtungen.json > > > > - curl -d "{\"docs\": [{\"Typ\":\"Beobachtung\"}]}" -X POST > > > > > > > > http://username:secretpassword@127.0.0.1:5984/evab/_all_docs?include_docs=true > > > > > > Beobachtungen.json > > > > - replacing {\"Typ\":\"Beobachtung\"} or {\"docs\": > > > > [{\"Typ\":\"Beobachtung\"}]} with "@TypBeob_Kriterien.json" to > > > > circumvent > > > > problems with the windows-command-tool and " or '. > > > > > > I consistently get all the data of all the docs in the CouchDb. > > > > > > From the documentation I have not understood: > > > > > > - _all_docs or _bulk_docs? It seems that both work the same. > > > > - Is ist maybe only possible to filter with keys = _id's? > > > > - Is it possible to fetch the data from a view? > > > > > > > > Or simply: What is the best way to do it? > > > > > > Thanks for help! > > > > > > Alexander Gabriel > --4dd0d410_62bbd95a_74b0--