在Mac上使用Couchbase 2.0 dp4
尝试使用列表进一步过滤我的视图。在这一点上,我只是想让任何列表与我的观点一起工作。到目前为止,我能得到的是:{“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}"
}
}
当我使用以下命令查询我的视图时:localhost:8092 / default / _design / AllScopes / _view / AllScopes?group = true
结果:
{"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 / default / _design / AllScopes / _list / ListScopes / AllScopes?group = true。
我能得到的只是上面的未知错误。我尝试过不同的列表功能代码和不同的url配置,但都失败了。此列表函数来自此处的示例:http://wiki.apache.org/couchdb/Formatting_with_Show_and_List#Listing_Views_with_CouchDB_0.10_and_later
如何获得使用视图的简单列表的任何帮助都会有所帮助。
答案 0 :(得分:1)
我认为Couchbase目前不支持列表,但它是将来添加的功能。 Couchbase和CouchDB共享很多共同点,但它们并不完全兼容。