Yes, you need to write a view with a map function (
http://wiki.apache.org/couchdb/HTTP_view_API) that emits an index of the
doc type. e.g.

    emit(doc.type, doc)

and then pass an array of the types you want to retrieve as the keys query
parameter to the view

For instance if you called the design document mydesign and the view
byType, the http request (before encoding) would be:

http://localhost:5984/database/_design/mydesign/_view/byType?keys=["a","b";]


On Sunday, 27 May 2012, Patrick Maia wrote:

> Hi all, imagine I have a database that stores documents like these:
>
> { "type":"a", "attr1":"value1.1", "attr2":"value2.1"}
> { "type":"a", "attr1":"value1.2", "attr2":"value2.2"}
> { "type":"b", "attr3":"value3"}
> { "type":"c", "attr4":"value4"}
>
> Is there some way to get all docs where type == "a" or  type == "b" doing
> just one http request to couchdb?
>
> Thanks,
>
> Patrick Maia
>

Reply via email to