Created
September 19, 2013 00:37
-
-
Save kevinmeredith/6617735 to your computer and use it in GitHub Desktop.
java.lang.IllegalArgumentException: can't serialize class scala.math.BigDecimal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package test | |
| import com.mongodb.casbah.Imports._ | |
| import org.scalatest._ | |
| import org.scalatest.matchers.ShouldMatchers | |
| import play.api.libs.json._ | |
| import play.api.{Play, Logger} | |
| class TestLoadingJsNumber extends FlatSpec with ShouldMatchers { | |
| "Trying to Insert a JsNumber" should "throw a BSON exception when trying BigDecimal serialization" in { | |
| val collection = MongoConnection()("test")("test") | |
| val obj: JsValue = Json.obj("age" -> JsNumber(100)) | |
| println("Json.stringify(obj): " + Json.stringify(obj)) | |
| val q = MongoDBObject("name" -> obj) | |
| collection.insert(q) | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that replacing
val obj...with the below line also throws a BSON serialization exception.