在Mac上使用Couchbase 2.0 dp4通過Couchbase上的列表訪問視圖的正確方法
嘗試使用列表進一步過濾我的視圖。在這一點上,我只是試圖讓任何名單與我的看法一起工作。到目前爲止,我所能得到的是:{「error」:「unknown_error」,「reason」:「undef」};
這裏是我的設計文檔:
{
"_id": "_design/AllScopes",
"_rev": "6-48c8555a",
"views": {
"AllScopes": {
"map": "function(doc) {\n\n if (doc.scope.search(/^\\{?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}?$/i) >= 0)\n {\n var obj = {};\n obj[doc.key] = doc.value;\n emit(doc.scope, obj);\n }\n\n}",
"reduce": "function(keys, values, rereduce) { ..removed..}"
}
},
"lists": {
"ListScopes": "function(head, req) {\n var row;\n start({\n \"headers\": {\n \"Content-Type\": \"text/html\"\n }\n });\n while(row = getRow()) {\n send(row.value);\n }\n}"
}
}
當我詢問我的看法:本地主機:8092 /缺省/ _design/AllScopes/_view/AllScopes組=真
結果在:
{"rows":[
{"key":"016f77d2-dd42-41b4-98e7-50daa14d9e02","value":{"row":"b2f31852-a864-4680-9242-487181844b31","parent":{"_type":"Scope","_id":"ea45da3e-5c91-4ef2-b64e-0158a0c83e79","_template":{"_type":"Template","_path":"_level2.trylistorview","_mode":"server"}},"mode":"edit","g":"4592f903-7815-4e6c-97be-503626c6628c","_template":"_level2.views","_childname":"views","_activefield":"viewname","_active":false}},
{"key":"026bdb98-52eb-4986-a5c1-a0bfaf928af0","value":{"row":"44ff7ff1-c49b-407e-832b-2777dc69f288","parent":{"_type":"Scope","_id":"676b7fea-8cc8-4e7f-a232-f055ad142b58","_template":{"_type":"Template","_path":"_template","_mode":"server"}},"mode":"edit","g":"4592f903-7815-4e6c-97be-503626c6628c","_template":"_template","_activefield":"options","_active":false}}
....
]}
然後嘗試使用列表與視圖使用 - localhost:8092/defa ULT/_design/AllScopes/_list/ListScopes/AllScopes?組=真。
我能得到的就是上面的未知錯誤。我嘗試了不同的列表功能代碼和不同的url配置,但都失敗了。此列表功能來自此處的示例:http://wiki.apache.org/couchdb/Formatting_with_Show_and_List#Listing_Views_with_CouchDB_0.10_and_later
任何有關如何獲得簡單列表視圖的幫助都將有所幫助。
我看到一些評論似乎表明它與CouchDB具有幾乎相同的功能後,我做出了可用的假設。希望它很快就會被添加。謝謝! – Mark 2012-04-16 13:45:48