如何给Futon添加列表功能?
我按照此处的说明将列表函数添加到我的 CouchDB: http://guide.couchdb.org/draft/transforming.html
当我访问url 对应于列表函数,我收到消息:
{"error":"not_found","reason":"missing_named_view"}
这是对应于我构建的列表函数的 url:
edtalmadge.iriscouch.com/burritohunter/_design/export/_list/bar/locations
这是文档中给出的网址:
/db/_design/foo/_list/列表名称/视图名称
我做错了什么?
这是我到目前为止所做的:
将视图文档添加到 Futon:
{"_id": "_design/locations", “_rev”:“16-c0702b81430f6b0d428c7a3e201dfc15”, “语言”:“javascript”, “意见”:{ “地点”:{ "map": "function(doc) { if(doc.type == 'location') {emit(null, { 'name': doc.name, 'address': doc.address, 'geolocation': doc.geolocation , '电话': doc.phone, 'open_24': doc.open_24, '啤酒': doc.beer, '评级': doc. rating, '类型':文档类型 }); } }}
向 Futon 添加了列表文档:
{"_id": "_design/export", “_rev”:“2-99c7be486f53d56926a8dc890e182d01”, “列表”:{ "bar": "function(head, req) { var row; while (row = getRow()) { return 'foo' } }", "zoom": "function() { return 'zoom!' }” }}
I'm following the instructions here to add a List Function to my CouchDB:
http://guide.couchdb.org/draft/transforming.html
When I visit the url corresponding to the list function, I get the message:
{"error":"not_found","reason":"missing_named_view"}
Here is the url corresponding to the list function I've constructed:
edtalmadge.iriscouch.com/burritohunter/_design/export/_list/bar/locations
Here is the url given in the documentation:
/db/_design/foo/_list/list-name/view-name
What am I doing wrong?
Here's what I have done so far:
Added views document to Futon:
{"_id": "_design/locations", "_rev": "16-c0702b81430f6b0d428c7a3e201dfc15", "language": "javascript", "views": { "locations": { "map": "function(doc) { if(doc.type == 'location') {emit(null, { 'name': doc.name, 'address': doc.address, 'geolocation': doc.geolocation, 'phone': doc.phone, 'open_24': doc.open_24, 'beer': doc.beer, 'rating': doc.rating, 'type': doc.type }); } }" } }}
Added lists document to Futon:
{"_id": "_design/export", "_rev": "2-99c7be486f53d56926a8dc890e182d01", "lists": { "bar": "function(head, req) { var row; while (row = getRow()) { return 'foo' } }", "zoom": "function() { return 'zoom!' }" }}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将列表函数添加到您的位置设计文档中,或者修改用于访问列表函数的 URL 以使用带有 _list/listName/designDocName/viewName 的完全限定视图名称,例如:
该 URL 当前有效,返回“foo”。 (如果位置/位置看起来很奇怪,那只是因为您的视图名称与设计文档名称相同。)
如果您没有通过包含设计文档来完全限定 URL 中的视图,则假定该视图属于列表函数所属的同一设计文档。
Either add your list function to your locations design document, or modify the URL for accessing your list function to use the fully qualified view name with _list/listName/designDocName/viewName, like:
That URL works currently, returning "foo". (If locations/locations looks weird, it's just because your view name is the same as your design doc name.)
If you don't fully qualify the view in the URL by including the design doc, it is assumed that the view belongs to the same design doc that the list function belongs to.