mongodb truncation exception csharp

Code Example - mongodb truncation exception csharp

                
                        //This means that there was an exception casting from a more detailed object to a less
//The solution that I found for mongodb was mapping and setting allowTruncation: true
//This is done at the startup level

BsonSerializer.RegisterSerializer(
                typeof(float),
                new DoubleSerializer(
                    BsonType.Double,
                    new RepresentationConverter(
                        allowOverflow: true,
                        allowTruncation: true
                    )
                )
            );