To understand 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 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.

- Jim

On May 15, 2011, at 1:34 PM, Alexander Gabriel <> wrote:

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


 - curl -d "{\"docs\": [{\"Typ\":\"Beobachtung\"}]}" -X POST


 - replacing {\"Typ\":\"Beobachtung\"} or {\"docs\":
 [{\"Typ\":\"Beobachtung\"}]} with "@TypBeob_Kriterien.json" to
 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