{"action":"created","issue":{"url":"https://api.github.com/repos/lordofthejars/nosql-unit/issues/161","repository_url":"https://api.github.com/repos/lordofthejars/nosql-unit","labels_url":"https://api.github.com/repos/lordofthejars/nosql-unit/issues/161/labels{/name}","comments_url":"https://api.github.com/repos/lordofthejars/nosql-unit/issues/161/comments","events_url":"https://api.github.com/repos/lordofthejars/nosql-unit/issues/161/events","html_url":"https://github.com/lordofthejars/nosql-unit/issues/161","id":171446733,"number":161,"title":"ClassCastException in Group at Util.extractField","user":{"login":"joergreichert","id":994131,"avatar_url":"https://avatars.githubusercontent.com/u/994131?v=3","gravatar_id":"","url":"https://api.github.com/users/joergreichert","html_url":"https://github.com/joergreichert","followers_url":"https://api.github.com/users/joergreichert/followers","following_url":"https://api.github.com/users/joergreichert/following{/other_user}","gists_url":"https://api.github.com/users/joergreichert/gists{/gist_id}","starred_url":"https://api.github.com/users/joergreichert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joergreichert/subscriptions","organizations_url":"https://api.github.com/users/joergreichert/orgs","repos_url":"https://api.github.com/users/joergreichert/repos","events_url":"https://api.github.com/users/joergreichert/events{/privacy}","received_events_url":"https://api.github.com/users/joergreichert/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-16T15:36:37Z","updated_at":"2016-08-19T08:21:30Z","closed_at":"2016-08-19T08:19:20Z","body":"With calling aggregate and using group by sum for float field \"my_attribute\"\r\n\r\n`mongoTemplate.aggregate(agg,` \"my_collection\", `Map.class);`\r\n\r\nthis causes a ClassCastException at line with Util.extractField (String cannot be cast to number)\r\n\r\n`com.github.fakemongo.impl.aggregation.Group.sum(DBCollection, Object)`\r\n\r\n```\r\nNumber result= null;\r\n...\r\n// object = { \"my_attribute\" : \"123.45\"}  \r\n// field = \"my_attribute\"\r\nresult = Util.extractField(object, field); // com.github.fakemongo.impl.Util.extractField(DBObject, String)\r\n```\r\n\r\nInside \"object\" the value is actual a string. \r\n\r\nBut 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.\r\n\r\nSo either the code should try to parse the String as Number (instead of casting it) or assure that the value is of correct type."},"comment":{"url":"https://api.github.com/repos/lordofthejars/nosql-unit/issues/comments/240957893","html_url":"https://github.com/lordofthejars/nosql-unit/issues/161#issuecomment-240957893","issue_url":"https://api.github.com/repos/lordofthejars/nosql-unit/issues/161","id":240957893,"user":{"login":"lordofthejars","id":1517153,"avatar_url":"https://avatars.githubusercontent.com/u/1517153?v=3","gravatar_id":"","url":"https://api.github.com/users/lordofthejars","html_url":"https://github.com/lordofthejars","followers_url":"https://api.github.com/users/lordofthejars/followers","following_url":"https://api.github.com/users/lordofthejars/following{/other_user}","gists_url":"https://api.github.com/users/lordofthejars/gists{/gist_id}","starred_url":"https://api.github.com/users/lordofthejars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lordofthejars/subscriptions","organizations_url":"https://api.github.com/users/lordofthejars/orgs","repos_url":"https://api.github.com/users/lordofthejars/repos","events_url":"https://api.github.com/users/lordofthejars/events{/privacy}","received_events_url":"https://api.github.com/users/lordofthejars/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T08:21:29Z","updated_at":"2016-08-19T08:21:29Z","body":"Thank you very much for using nosqlunit\n\nEl 19 ago. 2016 10:19 a. m., \"Jörg Reichert\" <notifications@github.com>\nescribió:\n\n> Closed #161 <https://github.com/lordofthejars/nosql-unit/issues/161>.\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/lordofthejars/nosql-unit/issues/161#event-760962031>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ABcmYVZa46ejIEVl4xpe1__y9oGbm9xzks5qhWcJgaJpZM4Jli-w>\n> .\n>\n"}}
{"actor":{"display_login":"lordofthejars"}}