title: How to count and get distrubtion of struct element in array field mongodb?
body: <p>Hello I'm working with collection MongoDB contain millions of documents each document contains:</p>
  
  <pre><code>       {
  "_id" : NumberLong(566994152),
  "data" : [ 
      {
          "key" : "der.0",
          "value" : "Ision"
      }, 
      {
          "key" : "d_ont",
          "value" : "Co_OT"
      }, 
      {
          "key" : "ol.tx",
          "value" : "3.35"
      }
      .
      .
      .
      . 
  
  ],
  "conclusion" : [ 
      {
          "rname" : "O",
          "rulename" : "FTNT"
      }
  ]
       }
  </code></pre>
  
  <p>My goal is to filter this collection based on a name of a key for example <code>key="d_ont"</code> the result is the number of different value of this key and the distribution of each value. for example for the key <code>"d_ont"</code> there is 3 value: <code>"value1"</code> <code>50</code> times <code>"value2"</code> <code>56</code> times and <code>"value3"</code> One time... </p>