Hello again couchbasia
I have a certain infrastructure to take care of volatility for me which revolves around the cas value.
The number conversion between the couchbase server and my app (C#aspnetcore) mismatch,
for instance when calling CouchbaseClient sdk Replace with a certain cas value result (IMutationResult ) ‘Cas’ member the value 1639300746363797504 (debug) is returned
and that I have implemented my own ITypeSerializer for couchbase client
public T Deserialize(Stream stream) // ITypeSerializer, also catches serialization requests for QueryDataResult<…> (IQueryResult?)
{
var sr = new StreamReader(stream);
stream.Flush();
var json = sr.ReadToEnd();
my issue is that json variable (read from the stream) is {... "cas": 1639300746363797504 ...} , note as a Raw JSON Number - but in database 1639300746363797500 … my guess is that the couchbase binary who has created this stream was relying on the same type of conversion (Javascript Number => UInt64) also to my understanding couchbase has a different bigint conversion from normal Javascript Number which i was wonder if i could reproduce in the couchbase client without going to the querying server (ie TONUMBER("…"))
I am also aware it is possible to can send a query to the server then specify TO_STRING(META(…).cas) but then I will be also require to use the REPLACE query and not the couchbase client sdk Repalce method which also got me wondering about the cost of this approach
N1QL doesn’t deal with external cas values (There is no interface to supply user cas value via N1QL). What version of CB you are using. If required try 6.6.3
select RAW TO_STRING(1639300746363797500);
{
"results": [
"1639300746363797500"
]
}
I Don’t know if there is any issue with N1QL. It might be SDKs that how convert. That is not my expertise.
If you use META().cas, TO_STRING(META().cas) it will not loose any precision represent as int64