title: Aggregation Framework - Group Operation throw NumberFormatException
body: <p>I'm using <code>Spring-Data MongoDB aggregation framework</code>.</p>
  
  <p>Here is a code sample:</p>
  
  <pre><code>Aggregation agg = Aggregation.newAggregation(
      match(Criteria.where("type").is("PROMO")),
      group("locale")//.count().as("counts")
  );
  
  
  AggregationResults&lt;Message&gt; results = mongoTemplate.aggregate(agg, "message", Message.class);
  return results.getMappedResults();
  </code></pre>
  
  <p>Throw:</p>
  
  <pre><code>org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.math.BigDecimal for value 'CL'; nested exception is java.lang.NumberFormatException
  </code></pre>
  
  <p><code>CL</code> is a value on locale field, but i dont understand why throw that exception.
  Im using a similar example from the <a href="http://docs.spring.io/spring-data/mongodb/docs/1.3.0.RC1/reference/html/mongo.core.html" rel="nofollow">documentation</a>.</p>
  
  <p>SOLVED:</p>
  
  <pre><code>Aggregation agg = Aggregation.newAggregation(
             match(Criteria.where("type").is("PROMO")),
             group("created", "text").addToSet("locale").as("countries").addToSet("device.deviceType").as("platforms").count().as("count")
      );
  </code></pre>
  
  <p>I try a simple example on mongo console. After that, map the operations to the builder.
  I dont undesrtand why dont work before. If someone can clear the problem will be great.</p>
  
  <p>The model "message":</p>
  
  <pre><code>{ "_id" : "90.0", "device" : { "_id" : "5faf92fd-37f2-4d42-a01a-dd1abce0c1af", "deviceType" : "iPhone", "countryId" : "AR" }, "text" : "Text", "created" : ISODate("2014-01-03T15:56:27.096Z"), "status" : "SENT", "type" : "PROMO" }
  </code></pre>