Closed joergreichert closed 8 years ago
Can you paste the whole stack trace? It seems a problem with fakemongo rather than nosqlunit ?
Yes, you're right. I wasn't aware that nosqlunit and fongo are different projects. I created a new bug for fongo: https://github.com/fakemongo/fongo/issues/224
Thank you very much for using nosqlunit
El 19 ago. 2016 10:19 a. m., "Jörg Reichert" notifications@github.com escribió:
Closed #161 https://github.com/lordofthejars/nosql-unit/issues/161.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lordofthejars/nosql-unit/issues/161#event-760962031, or mute the thread https://github.com/notifications/unsubscribe-auth/ABcmYVZa46ejIEVl4xpe1__y9oGbm9xzks5qhWcJgaJpZM4Jli-w .
For your interest: https://github.com/fakemongo/fongo/issues/224#issuecomment-241468965
Bit I'm not sure, on which side the bug should be fixed.
With calling aggregate and using group by sum for float field "my_attribute"
mongoTemplate.aggregate(agg,
"my_collection",Map.class);
this causes a ClassCastException at line with Util.extractField (String cannot be cast to number)
com.github.fakemongo.impl.aggregation.Group.sum(DBCollection, Object)
Inside "object" the value is actual a string.
But using an explicit class instead, e.g. a custom class Result, having myAttribute with the correct type doesn't help: object still contains a string as value.
So either the code should try to parse the String as Number (instead of casting it) or assure that the value is of correct type.