Does EF for MongoDB support the decimal data type from .NET out of the box? Or does a serializer still need to be registered?
Skip to main content
Hi @Nicholas_Vella,
You can use the .NET Decimal data type or Decimal 128 but by default but it maps to a string in MongoDB. However, you can use the BsonRepresentation
attribute ([BsonRepresentation(BsonType.Decimal128)]
) or the Fluent API with the EF Core provider to specify decimal 128 storage. Separately, we are planning to change the default in the next major version of the .NET/C# driver, you can track the progress of that in this ticket. Hope that helps.
Thanks,
Rishit.
Thank you for the clarification @Rishit_Bhatia
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
Question about requestID field in OP_MSG wire protocol | 1 | 508 | May 2024 |
MongoDB.Bson.BsonSerializationException: | 0 | 759 | Apr 2024 |
Atomic write to multiple records | 0 | 451 | May 2024 |
Darshan Hiranandani : Has anyone tried disabling writeConcern acknowledgment to improve performance? What were the results? | 1 | 46 | Sep 2024 |
Mongo C and C++ drivers security vulnerabilities (CVEs) | 2 | 95 | Jan 9 |