CouchDB Kitura 执行视图

CouchDB Kitura Executing a View

我正在使用以下代码对 CouchDB 使用 Kitura 执行 Swift 代码。

 database.queryByView("high-priority-tasks", ofDesign: "polls", usingParameters: [], callback: { (json: JSON?, error :NSError?) in

        if error != nil {
            try! response.status(.internalServerError).end()
        }

        response.send(json: json!)
    })

在我的 CouchDB 中,我创建了视图:

我收到以下错误:

po error?.localizedDescription!
▿ Optional<String>
  - some : "Error: not_found, reason: missing"

我认为queryByView中的Design参数应该是设计文档的名称(_design/之后的部分)你的情况可能是"high-priority-tasks"(在字段Design Document中被截断了)