0

在 Mac 上使用 Couchbase 2.0 dp4

尝试使用列表来进一步过滤我的观点。在这一点上,我只是试图让任何列表都符合我的观点。到目前为止,我能得到的是: {"error":"unknown_error","re​​ason":"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

有关如何获得与视图一起使用的简单列表的任何帮助都会有所帮助。

4

1 回答 1

1

我认为 Couchbase 目前不支持列表,但它是将来会添加的功能。Couchbase 和 CouchDB 有很多共同点,但它们彼此并不完全兼容。

于 2012-04-15T04:02:32.707 回答