title: How to aggregate with a Percentage of Total
body: <p>Here is my JSON data:</p>
  
  <pre><code>    [
        {
          "_id": "2017/4/7",
          "category": "science",
          "presenties ": 20,
          "absentee": 1
        },
        {
          "_id": "2017/4/19",
          "category": "science",
          "presenties ": 11,
          "absentee": 32
        },
        {
          "_id": "2017/4/19",
          "category": "Commerce",
          "presenties ": 10,
          "absentee": 32
        },
  
        {
          "_id": "2017/4/7",
          "category": "Arts",
          "presenties ": 20,
          "absentee": 16
        },
        {
          "_id": "2017/4/19",
          "category": "Arts",
          "presenties ": 10,
          "absentee": 21
        }
      ]
  </code></pre>
  
  <p>I would like to display :
     1) Percentages of presenties and absentee per category for each day, i tried aggregate function so am getting the total presenties and absentees  </p>
  
  <pre><code>[{
          "_id": "2017/4/7",
          "total_presenties ": 40,
          "total_absentee": 17
        },
        {
          "_id": "2017/4/19",
          "total_presenties ": 31,
          "total_absentee": 85
        }
      ]
  </code></pre>
  
  <p>2)but need to mention that percentage in to the above JSON according to the dates like this</p>
  
  <pre><code>[{
              "_id": "2017/4/7",
                  "category": "science",
                  "presenties ": 10,
                  "absentee": 21
                 "presenties_Precentage":xx%
                 "absentees_Precentage": xx%
            },{"_id": "2017/4/7",
                  "category": "commerce",
                  "presenties ": 10,
                  "absentee": 21
                 "presenties_Precentage":xx%
                 "absentees_Precentage": xx%},{
                  "_id": "2017/4/19",
                  "category": "Arts",
                  "presenties ": 10,
                  "absentee": 21
                 "presenties_Precentage":xx%
                 "absentees_Precentage": xx%
                }]
  </code></pre>
  
  <p>please help me here to complete this task</p>