---snip-map--
function(doc) {
for( var field in doc ) {
if( field.indexOf('_') != 0 ) {
emit( field, doc[field] );
}
}
}
---snip-map--
If you emit([field, doc[field]], null);
(ie, make the value itself part of the key) and a simple '_sum'
reduce, then querying with group=true you should get that unique list?
Yes, indeed! Guess I have to do some more unlearning :)
But, I will for the time being use my current method of creating a
design document for each field the user want this information for.
Since users are now storing complex objects using my library, I want
to avoid all the complex and often large data to be indexed. So they
can now define for which fields the views are updated automatically...
Daniel