是否有可能访问视图中的请求查询字符串参数?CouchDB - 在视图中访问查询字符串参数
考虑这一请求...... GET/database/_designs/foo/?bar=1
而这个地图...
views {
foo: {
map: function (document)
{
// I want to access querystring parameter "bar" here! But how?
// I'd like to be able to do something along the lines of...
if (bar > 0) emit(null, document);
}
}
}
只有在查看视图时才允许传输一个参数(“key”)。我对吗?或者你可以传递自定义密钥? – roosteronacid 2011-04-11 13:46:28
有关[CouchDb:权威指南](http://guide.couchdb.org/editions/1/en/cookbook.html#key)的工作方式的更深入的解释。它也有使用查询字符串的非couch.js示例。 CouchDb wiki有一个完整的查询参数列表:http://wiki.apache.org/couchdb/HTTP_view_API?action=show&redirect=HttpViewApi#Querying_Options – Tayler 2013-07-12 05:02:16