title: Is there a way to get the length of an object field in mongodb?
body: <p>I have following objects in <code>MongoDB</code>:</p>
  
  <pre><code>[
      {
          "name": "pencil",
          "purchase_record": {
              "1":"$900",
              "2":"$1000",
              "3":"$1100",
              "4":"$1200"
          }
      },
      {
          "name": "pen",
          "purchase_record": {
              "1":"$1000",
              "2":"$1200",
              "3":"$900",
              "4":"$1100",
              "5":"$1100"
          }
      }
  ]
  </code></pre>
  
  <p>Is there a way to get the length of <code>purchase_record</code> for each record?</p>