title: which is faster: views or allDocs with Array.filter?
body: <p>I was wondering about performance differences between dedicated views in CouchDb/PouchDb VS simply retrieving allDocs plus filtering them with Array.prototype.filter later on.</p>
  
  <p>Let's say we want to get 5,000 todo docs stored in a database. </p>
  
  <pre><code>// Method 1: get all tasks with a dedicated view "todos"
  
  // in CouchDB
  function (doc) { 
    if (doc.type == "todo"){
        emit(doc._id);
    }
  }
  
  // on Frontend
  var tasks = (await db.query('myDesignDoc/todos', {include_docs: true})).rows;
  
  
  // Method 2: get allDocs, and then filter via Array.filter
  
  var tasks = (await db.allDocs({include_docs: true})).rows;
  tasks = tasks.filter(task =&gt; {return task.doc.type == 'todo'});
  </code></pre>
  
  <p>What's better? What are the pros and cons of each of the 2 methods? </p>