Because emit() takes two parameters, one is the key, one is the value. However, you can emit arrays as key and/or as value, and they will be sorted as expected:
emit([doc.user.friends_count, doc.user.followers_count], doc.id_str); Or something similar... By the way, what is id_str? If you want to use the doc when requesting the view, it is better to request the document directly with ?include_docs=true, saving you a roundtrip to the server. On February 1, 2015, Ayhan Kesenci <[email protected]> wrote: > Why it is not possible to create a view like this > > function(doc) { > emit(doc.user.friends_count,doc.user.followers_count,doc.id_str); > } > > > ?? >
