如何给Futon添加列表功能?

发布于 2024-11-29 04:59:53 字数 1264 浏览 0 评论 0原文

我按照此处的说明将列表函数添加到我的 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/列表名称/视图名称

我做错了什么?

这是我到目前为止所做的:

  1. 将视图文档添加到 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, '类型':文档类型 });
       }
     }}
    
  2. 向 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:

  1. 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 }); }  }"
       }
     }}
    
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁吢 2024-12-06 04:59:53

将列表函数添加到您的位置设计文档中,或者修改用于访问列表函数的 URL 以使用带有 _list/listName/designDocName/viewName 的完全限定视图名称,例如:

edtalmadge.iriscouch.com/burritohunter/_design/export/_list/bar/locations/locations

该 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:

edtalmadge.iriscouch.com/burritohunter/_design/export/_list/bar/locations/locations

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文