title: How do you sort results of a _View_ by value in the in Couchbase?
body: <p>So from what I understand in Couchbase is that one can sort keys* by using</p>
  
  <pre><code>descending=true
  </code></pre>
  
  <p>but in my case I want to sort by values instead. Consider the Twitter data in json format, my question is <strong>What it the most popular user mentioned?</strong></p>
  
  <p>Each tweet has the structure of:</p>
  
  <pre><code>{
      "text": "",
      "entities" : {
          "hashtags" : [ ... ],
          "user_mentions" : [ ...],
          "urls" : [ ... ]
  }
  </code></pre>
  
  <p>So having used MongoDB before I reused the Map function and modified it slightly to be usable in Couchbase as follows:</p>
  
  <pre><code>function (doc, meta) {
    if (!doc.entities) { return; }
  
    doc.entities.user_mentions.forEach(
      function(mention) {
        if (mention.screen_name !== undefined) {
          emit(mention.screen_name, null);
        }
      }
    )
  }
  </code></pre>
  
  <p>And then I used the reduce function <code>_count</code> to count all the <code>screen_name</code> occurrences. Now my problem is <strong>How do I sort by the count values, rather than the key?</strong></p>
  
  <p>Thanks</p>