Open gongdo opened 7 years ago
Is there any status on this issue, or #288?
I'm not sure if you're perceiving this issue in the same way that I do, but doesn't this issue mean that DocumentDb (or at least this client) is fundamentally broken until this is fixed? I have data that I can't store in DocumentDb, because when I go to retrieve it I get a long value for an ID that has no meaning to any other record. The data may be "correct" in the cloud store, but by the time it's retrieved via query that's not the case. The data is meaningless.
If this was my product, my reaction would be "OMFG" and I would be doing whatever I could to resolve it. Is there some workaround I'm not seeing, other than "don't store long values"?
@arramac could you please response to this thread.
@chriswill, sorry about the trouble you've been having. The DocumentDB type system supports only IEEE754 numbers (which are floating point). main reason we haven't introduced Int64 is that there is no high-fidelity way to support it with the Json/JavaScript query type system (details here https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-sql-query-reference)
However, we understand that richer types like Int64 (and DateTime, Guid, etc.) are necessary for a wide range of applications. We support these types in other access APIs of Cosmos DB, and are planning to introduce them in the DocumentDB API as an extended-JSON wire format and serializer/de-serializer.
Meanwhile, please note the lower precision is only for query processing, not in storage. For query processing, as a workaround you can store the numbers as strings or as hex strings (for range comparison).
If you have more questions, please reach out to us at AskCosmosDB@microsoft.com, and we can discuss over a call.
I'm using
Microsoft.Azure.DocumentDB.Core
1.3.2
as a .NET Core client.I have a document in the DocumentDb Collection like this:
And I want to get the document as this type:
When I query documents without sql expression, it returns the document as I expected. However, when I query documents with sql expression - both sqlExpression and Linq query, it breaks long number's precision. I tried like this:
And results are:
The query processor seems have a glitch for dealing with long number conversion, only when query with any Linq expression or direct sql expression. sync, async and cross-partition option are not cause of this issue.
Even worse thing is, if I receive the long number property with object type, then the client treats the long number as double type.
Notice, there's no issue when query without any query expressions. That's why I believe this is a bug in the client processing.
It looks like https://github.com/Azure/azure-documentdb-dotnet/issues/151 issue, but I'm not sure why that is happened. And there's no workaround here.