2011-08-09 38 views
3

我按照说明在这里单功能添加到我的CouchDB: http://guide.couchdb.org/draft/transforming.html如何添加列表功能到蒲团?

当我访问对应列表功能的URL,我得到的消息:

{"error":"not_found","reason":"missing_named_view"} 

这里是对应列表功能网址我已经构造:

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

这里是文档中给出的网址:

/DB/_design /富/ _list /列表名称/视图名称

我在做什么错?

这是我迄今所做的:

  1. 增加的视图文件被褥:

    {"_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. 添加列表文件被褥:

    {"_id": "_design/export", 
    "_rev": "2-99c7be486f53d56926a8dc890e182d01", 
    "lists": { 
        "bar": "function(head, req) { var row; while (row = getRow()) { return 'foo' }     
        }", 
        "zoom": "function() { return 'zoom!' }" 
    }} 
    

回答

4

无论是将你的列表功能添加到你的位置设计文件,或修改URL来访问您的列表功能与_list/LISTNAME/designDocName /的viewName使用完全合格的视图名称,如:

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

该URL的作品目前,返回“富”。 (如果位置/位置看起来很奇怪,那只是因为您的视图名称与设计文档名称相同。)

如果您没有通过包含设计文档来完全限定URL中的视图,则假定该视图属于列表功能所属的同一设计文档。

+0

哇,我试了一百万不同的方式,没有运气。谢谢你的好解释。非常感激。 – edt