title: mongo $unwind and sum individually the third value of returning and new visitors
body: <p>From the following document example:</p>
  <pre><code>{
      &quot;_id&quot; : ObjectId(&quot;528e4798bfa9782c078b4662&quot;),
      &quot;query&quot; : {
          &quot;start-date&quot; : ISODate(&quot;2013-11-19T00:00:00Z&quot;),
          &quot;end-date&quot; : ISODate(&quot;2013-11-20T00:00:00Z&quot;),
          &quot;ids&quot; : &quot;ga:69564270&quot;,
          &quot;dimensions&quot; : &quot;ga:visitorType,ga:visitCount&quot;,
          &quot;metrics&quot; : [
              &quot;ga:organicSearches&quot;
          ]
      },
      &quot;columnHeaders&quot; : [
          {
              &quot;name&quot; : &quot;ga:visitorType&quot;,
              &quot;columnType&quot; : &quot;DIMENSION&quot;,
              &quot;dataType&quot; : &quot;STRING&quot;
          },
          {
              &quot;name&quot; : &quot;ga:visitCount&quot;,
              &quot;columnType&quot; : &quot;DIMENSION&quot;,
              &quot;dataType&quot; : &quot;STRING&quot;
          },
          {
              &quot;name&quot; : &quot;ga:organicSearches&quot;,
              &quot;columnType&quot; : &quot;METRIC&quot;,
              &quot;dataType&quot; : &quot;INTEGER&quot;
          }
      ],
      &quot;totalsForAllResults&quot; : {
          &quot;ga:organicSearches&quot; : 119
      },
      &quot;rows&quot; : [
          [
              &quot;New Visitor&quot;,
              &quot;1&quot;,
              100
          ],
          [
              &quot;Returning Visitor&quot;,
              &quot;11&quot;,
              1
          ],
          [
              &quot;Returning Visitor&quot;,
              &quot;2&quot;,
              10
          ],
          [
              &quot;New Visitor&quot;,
              &quot;3&quot;,
              4
          ],
          [
              &quot;Returning Visitor&quot;,
              &quot;4&quot;,
              1
          ],
          [
              &quot;Returning Visitor&quot;,
              &quot;5&quot;,
              1
          ],
          [
              &quot;New Visitor&quot;,
              &quot;6&quot;,
              1
          ],
          [
              &quot;New Visitor&quot;,
              &quot;8&quot;,
              1
          ]
      ],
      &quot;query_name&quot; : &quot;GA Organic Traffic Metric&quot;,
      &quot;profile_id&quot; : 666,
      &quot;retrieve_date&quot; : ISODate(&quot;2013-11-21T17:49:12Z&quot;)
  }
  </code></pre>
  <p>How can I use the mongo aggregate framework:</p>
  <h1>1 To group and project the sum of: New visitors by &quot;query.start-date&quot;</h1>
  <h1>2 To group and project the sum of: Returning Visitors by &quot;query.start-date&quot;</h1>
  <p>Currently, as You can see &quot;ga:organicSearches&quot; I am having the sum of both, but I need each type of visitors individually, something like &quot;ga:organicSearchesReturningVisitors&quot; and &quot;ga:organicSearchesNewVisitors&quot;.</p>
  <p>Thanks in advance.</p>