Add it as part of the key. I would recommend
emit([category, doc.name], doc)
On Sep 7, 2012 2:22 PM, "Stephan Bardubitzki" <[email protected]>
wrote:
> Still learning CouchDB, I have the following view function:
>
> ||"|getAllByCategory|":|{
> "|map|":|"function(doc) { if(doc.categories) { doc.categories.forEach(
> **function(category) { emit(category, doc) });}}"|
> }|||
>
> That gives me all docs for a certain category. I would like to have the
> emitted docs sorted by doc.name, how can I achieve that?
>
> Thanks,
> Stephan
>