Skip to content

API code samples do not support CouchDb reduce queries. #2

@tohagan

Description

@tohagan

I think you want to support both map and reduce properties but the current API (as documented) only appears to support map functions.

Example ....

{
  person: {
    views: {
      byFirstName: {
        map: function (doc) { emit(doc.firstName); }
      },
      countFirstNames: {
         map: function (doc) { emit(doc.firstName, 1); }
         reduce: '_sum'
      }
    }
  }

You can keep your API backward compatible by converting each myview: function() ... to myview: { map: function() ...} when view value is a function rather than an object.

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