David Wolever
David Wolever

Reputation: 154494

CouchDB: query for "documents tagged with A or B"?

Short of doing client-side filtering or POSTing a one-off map/reduce (which would result in a table scan), is there any way to query for documents tagged with tagA or tagB?

Upvotes: 2

Views: 636

Answers (1)

mikeal
mikeal

Reputation: 4057

issue a POST request with a body of {"keys":["tagA","tagB"],"include_docs":true} to a view with a map of function(doc){doc.tags.forEach(function(tag){emit(tag,1)})}

that should do yah :)

from query options section in http://wiki.apache.org/couchdb/HTTP_view_API

Upvotes: 6

Related Questions