I'm currently using the Azure DocumentDB to store product data with prices. Nearly everything is working quite fine but now I have the issue that my decimals (System.Decimal) are being truncated when reading from DocumentDB.
For example this price:
Input Price: 25.1132356547854257645454
will be truncated into
DocumentDB Price: 25.113235654785
As we are using a sync mechanism to find price changes, this will result into a price change as it is not the same price anymore.
I have no idea how I can change the behavior of the DocumentDB. In worst case I would have to truncate my input prices to prevent this problem, but I would rather not.
Thanks for help.
CosmosDB is the new DocumentDB for NoSQL solution. The Azure Cosmos DB DocumentDB API or SQL (DocumentDB) API is now known as Azure Cosmos DB SQL API. You don't need to change anything to continue running your apps built with DocumentDB/DocumentDB API.
The maximum size of a document today is 2MB.
August 5, 2021. Cosmos DB automactially adds a timestamp field called “_ts”. everytime a document is created or updated.
Atoms consist of a small set of primitive types e.g. string, bool, number etc., records are structs and sequences are arrays consisting of atoms, records or sequences. The database engine of Azure Cosmos DB is capable of efficiently translating and projecting the data models onto the ARS based data model.
Azure DocumentDB uses IEEE floating point numbers per the JSON standard. This is required so that the data is portable across different programming platforms and applications. Unfortunately, this can lead to the truncation of large integers or higher precision decimal numbers like you're seeing.
To work around this, please consider breaking up the number to a two part number, representing as a string if you're only using for equality, or storing the truncated representation.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With