Zubair Zubair - 11 months ago 75
Java Question

MongoDb stores Float field as Double. Getting IllegalArgumentException

Data is stored correctly, however when I get the data back from Mongodb, I get the

IllegalArgumentException. cannot set java.lang.Float to java.lang.Double.

Does it have any converters, which will convert automatically from

Answer Source

You need to deserialize the object, and assign to the lowest leaf of the tree. and then use the converter to convert from double to float and vice versa.