Truncation resulted in data loss.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.7.0
    • Component/s: Serialization
    • None
    • Environment:
      .NET Core 2.1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When running an aggregation through LINQ using IMongoQueryable I get this error when mapping to a decimal.

      My mapping looks like this:

      BsonClassMap.RegisterClassMap<SkuToOrder>(x =>
      {
          x.AutoMap();
          x.MapProperty(prop => prop.CurrentStock).SetSerializer(new DecimalSerializer(BsonType.Decimal128, new RepresentationConverter(false, true)));
          x.MapProperty(prop => prop.NeededStock).SetSerializer(new DecimalSerializer(BsonType.Decimal128, new RepresentationConverter(false, true)));
          x.MapProperty(prop => prop.StockToOrder).SetSerializer(new DecimalSerializer(BsonType.Decimal128, new RepresentationConverter(false, true)));
          x.SetIgnoreExtraElements(true);
      });
      

      Here's an example model which generates this error:

      { 
          "Sku" : "0242", 
          "Description" : "xxx", 
          "CurrentStock" : NumberDecimal("0"), 
          "NeededStock" : NumberDecimal("0.6666666666666666666666666666666667"), 
          "StockToOrder" : NumberDecimal("0.6666666666666666666666666666666667")
      }
      

       

              Assignee:
              Robert Stam
              Reporter:
              Brecht Vanhaesebrouck
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: