Differences in MongoDB deserialization after updating the MongoDB library.

Before updating the library, my application used to store data in MongoDB like this: ‘field’: {‘$numberDecimal’: ‘1.00000000’}. After the update, it’s storing data like this: ‘field’: ‘1.00000000’. I would like to know how to modify it so that I can deserialize the object both in the old and new formats. A large volume of data has already been stored in the new format, but there is still a much larger amount of data stored in the old format. I am using BsonMapper to deserialize MongoDB fields. It works correctly when the data is in the new format, but it breaks when it’s in the old format.

In the same application, I’m mapping to retrieve data from the database. The decimal field is mapped as follows:

cm.MapMember(p => p.Field1).SetElementName("field1").SetSerializer(new DecimalSerializer(BsonType.Decimal128));

When I receive data in the old format, the application breaks.