Zubair Zubair - 1 year ago 134
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download