title: mongodb group and subgroup counts
body: <p>I have the following document type</p>
  
  <pre><code>{
      "_id" : "-fA2845ORqeyMUItKXfqZw",
      "user" : "553247ffdc8a4ade4bb09c5e",
      "state" : 2,
      "metadata" : {
          "language" : "en-US"
      },
      "pipeline" : {
          "api" : "http://localhost:4000",
          "provider" : 0
      },
      "ingest" : {
          "mimetype" : "audio/mpeg",
          "size" : 92794268,
          "client" : "computer",
          "isWriteable" : true
      },
      "assembly" : {
          "ok" : "ASSEMBLY_EXECUTING",
          "message" : "The assembly is currently being executed.",
          "assembly_id" : "23f29680b32911e59d48f358b85e112d",
          "parent_id" : null,
          "template_id" : null,
          "bytes_received" : 1265,
          "bytes_expected" : null,
          "upload_duration" : 0.079,
          "client_agent" : null,
          "client_referer" : null,
          "start_date" : "2016/01/04 21:21:38 GMT",
          "is_infinite" : false,
          "has_dupe_jobs" : false,
          "execution_start" : "2016/01/04 21:21:38 GMT",
          "execution_duration" : 0,
          "notify_start" : null,
          "notify_duration" : null,
          "last_job_completed" : null,
          "fields" : {
  
          },
      "export" : null,
      "job" : null,
      "transcript" : null,
      "status" : "transcoding",
      "created" : ISODate("2016-01-04T21:21:38.364Z"),
      "updated" : ISODate("2016-01-04T21:21:38.364Z")
  }
  </code></pre>
  
  <p>i like to get a breakdown of the file extensions and group these by status</p>
  
  <pre><code>&gt; db.files.aggregate([{"$match": {"created": { "$gte" : ISODate("2016-01-01T00:00:00Z")}}},{"$group" : {_id:"$status", count:{$sum:1}}}]);
  { "_id" : "transcoding error", "mimetype": ["audio/mpeg": 85, "audio/mp4":  65, .... ]}
  { "_id" : "edited", "mimetype": ["audio/mpeg": 85, "audio/mp4":  65, .... ] }
  { "_id" : "transcribed", "mimetype": ["audio/mpeg": 85, "audio/mp4":  65, .... ] }
  { "_id" : "transcribing","mimetype": ["audio/mpeg": 85, "audio/mp4":  65, .... ] }
  { "_id" : "received", "mimetype": ["audio/mpeg": 85, "audio/mp4":  65, .... ] }
  { "_id" : "transcoding", "mimetype": ["audio/mpeg": 85, "audio/mp4":  65, .... ]  }
  { "_id" : "blocked", "mimetype": ["audio/mpeg": 85, "audio/mp4":  65, .... ]  }
  </code></pre>
  
  <p>so for each status, i would like to subgroup by <code>"mimetype"</code> type?</p>
  
  <p>any advise much appreciated</p>