Search code examples
iosswiftkitura

CouchDB Kitura Executing a View


I am using the following code to execute Swift code using Kitura against CouchDB.

 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!)
    })

In my CouchDB I have created the view:

enter image description here

I get the following error back:

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

Solution

  • I think ofDesign parameter in queryByView should be the name of the design document (the part after _design/) In your case it is probably "high-priority-tasks" (it is truncated in the field Design Document).