2011-08-09 58 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