Search code examples
azureazure-cosmosdb

Azure Cosmos DB shows wrong LONG value


I am not sure if I am doing something wrong or cosmos db has a bug in the UI.

We are storing a LONG (INT64) value in the database, it seems it is stored correctly, but it is shown wrong in the UI. enter image description here

As you can see, I have a complete different value in the WHERE condition as in the response.


Solution

  • This is an issue on the Azure Portal only, the reason is that Javascript in the browser has precision limits and it's officially documented at: https://learn.microsoft.com/azure/cosmos-db/faq#why-are-long-floating-point-values-in-a-document-rounded-when-viewed-from-data-explorer-in-the-portal-

    This is limitation of JavaScript. JavaScript uses double-precision floating-point format numbers as specified in IEEE 754 and it can safely hold numbers between -(253 - 1) and 253-1 (i.e., 9007199254740991) only.