CouchDB / Couchbase view ordered by number of keys
问题 I'm trying to write a view which shows me the top 10 tags used in my system. It's fairly easy to get the amount with _count in the reduce function, but that does not order the list by the numbers. Is there any way to do this? function(doc, meta) { if(doc.type === 'log') { emit(doc.tag, 1); } } _count As a result I'd like to have: Tag3 10 Tag1 7 Tag2 3 ... Instead of Tag1 7 Tag2 3 Tag3 10 Most importantly, I do not want to transfer the full set to my application server and handle it there. 回答1