I'm using official mongo-scala-driver 2.0.0
. And try update field with BigDecimal
value:
myCollection.findOneAndUpdate(
equal("_id", "someId"),
set("money", BigDecimal(100.0))
).headResult()
And it give's me:
org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class scala.math.BigDecimal
But insertion accepts BigDecimal
:
myCollection
.insertOne(
Document("_id" -> "someId", "money" -> BigDecimal(100.0))
).headResult()
What is correct way to update BigDecimal field? Is that correct, that insertion supports codec, but update - not