title: Group documents by _id but allow for searching by other values
body: <p>I have documents and a view where you can search by the keywords list.  A document may look like:</p>
  
  <pre><code>{
    _id: "foo",
    keywords: ["bar", "baz"],
  }
  </code></pre>
  
  <p>Then, I have the view:</p>
  
  <pre><code>map: function (doc) {
    doc.keywords.forEach(function(word) {                                  
      emit(word, doc);                                            
    });
  }
  </code></pre>
  
  <p>This works great in that I get the <code>foo</code> document back, but the issue is if I don't provide a key I get this document twice which makes sense because it has two keywords.  However, I only need/want the document once.</p>
  
  <p>I have also added</p>
  
  <pre><code>reduce: function (key, value, rereduce) {                               
    return value;                                                   
  }
  </code></pre>
  
  <p>but this gives me <code>reduce_overflow_error</code>.  If I use <code>return null</code> then the value I get for the document is <code>null</code> which is no good either.</p>
  
  <p>I've also read about using a list function for this, but I'm not sure where the <em>list</em> function is supposed to go in the couchapp.  This also seems pretty complicated for what I think should be fairly simple.</p>
  
  <p>How can I stop the duplicates from coming when querying the view?</p>