开发者

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

开发者 https://www.devze.com 2023-01-07 15:08 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消