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.