【问题标题】:Proper way to access a view with a list on Couchbase使用 Couchbase 上的列表访问视图的正确方法
【发布时间】:2012-04-13 21:43:15
【问题描述】:

在 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

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

【问题讨论】:

    标签: list view couchbase


    【解决方案1】:

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

    【讨论】:

    • 在我看到一些似乎表明它与 CouchDB 功能几乎相同的 cmets 后,我假设它是可用的。希望它尽快添加。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2019-02-11
    • 1970-01-01
    • 2021-11-16
    • 2015-04-28
    • 1970-01-01
    • 1970-01-01
    • 2016-05-19
    • 2011-07-03
    相关资源
    最近更新 更多