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 tagge开发者_开发技巧d with tagA
or tagB
?
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
精彩评论