title: How to count number of fields inside an embedded documents in MongoDB
body: <p>I have a document as given below:  </p>
  
  <pre><code>{
      "_id" : ObjectId("58f5f4e0e405972824b8ff03"),
      "type" : "Defect Status",
      "data" : {
          "1" : [ "121764", "Bug", "7/6/15", "Closed" ],
          "2" : [ "121830", "Bug", "7/7/15", "Closed" ],
          "3" : [ "122333", "Bug", "7/16/15","Closed"],
          "4" : [ "122339", "Bug", "7/16/15","Closed"],
          "5" : [ "122340", "Bug", "7/16/15", "Closed"]
       }
  }
  </code></pre>
  
  <p>I want to calculate the number of fields inside the <code>data</code> field which is an embedded document inside another document. As it is not an array so, I can't find a way.</p>