Skip to content

Improve documentation for queryByView with decodeDocuments #107

@djones6

Description

@djones6

#97 introduced the decodeDocuments helper function, and adds comments that elude to the fact that when querying documents from CouchDB, you must set the include_docs parameter to true for Couch to include the documents themselves in the response. However, the existing queryByView function does not document this requirement, and so it could be confusing that something like this does not work:

database.queryByView("fruitView", ofDesign: "fruitDesign", usingParameters: []) {
(documents, error) in
    let fruitDocs = documents?.decodeDocuments(ofType: Fruit.self)
    ....
}

The solution in this case is to add usingParameters: [.includeDocs(true)]. I feel this use-case should be discussed in the documentation for the queryByView function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions