couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Klo <>
Subject Re: how to make queries with logical operators?
Date Sun, 27 May 2012 06:39:32 GMT
Yes and No.

Yes you can do it, but requires a map function to only emit docs of type a and c. That will
create a view with docs that are only of types a and c. And once you have a view - one request
of the view will get you what you want. 

But my guess is - that's probably not what you would like to do. I'm betting you're wanting
some kind of query capability (like SQL) which CouchDB doesn't have natively, but you could
get close with ElasticSearch or CouchDB Lucene.  Natively the closest you could get is either
doing the first option above or creating a view that emits type as a key. You could then do
two range queries on the view first to get the "a" docs and second to get the "c" docs. 


Sent from my iPhone

On May 26, 2012, at 8:42 PM, "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

View raw message