title: Couch DB filter by key and sort by another field
body: <p>In couchdb I need to filter by key and which is done like this.</p>
  
  <pre><code>{
     "_id": "_design/test",
     "_rev": "6-cef7048c4fadf0daa67005fefe",
     "language": "javascript",
     "views": {
         "all": {
             "map": "function(doc) { if (doc.blogId) {emit(doc.key, doc);} }"
         }
     }
  }
  </code></pre>
  
  <p>However the results should be ordered by another key (doc.anotherkey). So using the same function how do I achieve both filtering and ordering by another key.</p>
  
  <p>Thank you</p>