guys I have a doubt related to BigDecimal value support by Spring Data MongoDB, could someone help me with some news about it, if there will be support for this type, or if anyone knows a workaround to supply my needs. That's the deal: I'm working on a project where we use MongoDB as a DB and Spring as framework, we would like to save the fields where we are supposed to get money values in the database as BigDecimal, I've read that mongo only accepts double as a float number, but I don't think this type is going to be useful. Could you guys give me some light about it?
Spring Data MongoDB converts BigDecimal
values to String
on write and back to when reading. Please have a look at the data mapping and type conversion section of the reference manual.
The default conversion can be modified via @Field(targetType=...)
as shown below.
@Field(targetType = DECIMAL128)
private BigDecimal value;