title: Using couchdb to display views grouping
body: <p>I have multiple documents stored that look like this and I want to aggregate the records, appts and calls into a view.</p>
  
  <pre><code>{
      "_id": "1010997127",
      "_rev": "1-a570c157b140839b4214569b831a8791",
      "value": {
          "rev": "1-a570c157b140839b4214569b831a8791"
      },
      "key": "1010997127",
      "doc": {
          "_id": "1010997127",
          "_rev": "1-a570c157b140839b4214569b831a8791",
          "appted": "no",
          "called": "yes",
          "user": "user1"
      }
  }
  
  ... more ...
  </code></pre>
  
  <p>I want my view output to look like this.</p>
  
  <pre><code>{
      rows: [
          {
              user: "user1",
              records: 280,
              called: 22,
              appted: 11
          },
          {
              user: "user2",
              records: 34,
              called: 33,
              appted: 22
          },
          {
              user: "user3",
              records: 291,
              called: 44,
              appted: 33
          }
      ]
  }
  </code></pre>
  
  <p>Is this or a version of this possible using couchdb views?</p>
  
  <p>In the map function I did this and reduced it using  <code>_count</code></p>
  
  <pre><code>function (doc, meta) {
    emit(doc.user, doc.called);
  }
  </code></pre>
  
  <p>and the output does not count the calls?</p>
  
  <pre><code>{
      rows: [
          {
              key: "user1",
              value: 280
          },
          {
              key: "user2",
              value: 34
          },
          {
              key: "user3",
              value: 291
          }
      ]
  }
  </code></pre>