Skip to content

standardize results #21

@Flamenco

Description

@Flamenco
  • When I mango query, the results are returned in response.data.docs.
  • When I doc query, the doc are returned in response.data.doc.
  • When I view query, the results are returned in response.data.rows.

They are all docs.

Furthermore, for mango and view, I need to check the length to find out if there were any results.

if (response.data.rows.length > 0){
   response.data.rows.forEach(row=>{})
}

I would like to simply code this (in all cases):

if (response.hasDocs(){
   response.getDocs().forEach(doc=>{});
}

or even better

response.getDocs().forEach(doc=>{});

or even better

response.forEachDoc(doc=>{})

Any thoughts on shoving a forEachDoc interface into the response object before calling resolve on the promise?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions