-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Due to space limitation I attached all code as a file.
Consider code sample 1 and 2. They do exactly the same aggregation. They output result using the same LiabilitySetTotals class. This class has few decimal properties. In the DB those values are double. Therefore those properties have [BsonRepresentation(BsonType.Double, AllowTruncation = true)] attribute.
When I use "inline" style of building group expression for aggregation using BsonDocument, output result as a document and convert it to my LiabilitySetTotals, all works fine.
But when I use Linq to build group expression using the LiabilitySetTotals directly, I get an error:
System.FormatException : An error occurred while deserializing the TotalAmount property of class ...LiabilitySetTotals: Truncation resulted in data loss.
It looks like aggregation does not pay attention to BsonRepresentation attribute.
- duplicates
-
CSHARP-1321 Custom Serializers in $group
- Closed