Accepted answer

did you try set allowtruncation=true for your properities in city class?

public class city
    [bsonrepresentation(, allowtruncation=true)]
    public string id { get; set; }
    [bsonrepresentation(, allowtruncation=true)]
    public int value { get; set; }        

how do i set the serialization options for the geo values using the official 10gen c# driver?


you typically don't want your model to know or care how it's being stored, so peppering it with mongodb.bson attributes is not ideal. you can configure how mongodb.driver should read and store decimals with this config instead.

   new decimalserializer(bsontype.double,
   new representationconverter(
     true, // allow overflow, return decimal.minvalue or decimal.maxvalue instead
     true //allow truncation


Related Query

More Query from same tag