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 |
---|---|---|---|
How to connect using certificate and ignore certificate errors | 1 | 1.2k | May 2024 |
golang driver does not connect with correct connection string | 1 | 708 | Apr 2024 |
Help Needed: Insert Operation Taking Long Time with High Lock Counts | 0 | 304 | Jun 2024 |
Configuring classMap for included subcollection | 6 | 483 | Jul 2024 |
BsonClassMapSerializer is now sealed in v3.0 | 1 | 49 | Oct 2024 |