Increment/Decrement do they use integer or ulong values ?

In the .NET API the method signature is Increment (string, ulong, ulong, ...) and Decrement(string, ulong, ulong). However All the documentation refers to *integer* values for incr and descr values. Is this a documentation error? What should I use in my C# code? integer, uint, or ulong?

*kinda answering own question*

Did more testing with .NET. Great! It is indeed handling it as a ulong (unsigned long int)
my ulong max value = 18446744073709551615
When incrementing past that value, it just overflows back to zero.
I guess on the server side it's storing the value as a string, and letting the client API decide how to parse the value. Why Java has the same method as (string, long, long) because Java doesn't have ulong.

I use Java API and to me this question was also not clear. I wrote little script, that just increment value to 1000000 and saw what the maximum value can take counter.

Glad I'm not the only one wondering :) In another place the docs (cb-incr-decr.html) say "Couchbase Server requires that the value be an ASCII number" What does this even mean? ASCII is a character set/ string encoding, not an integer data type.

1 Answer

« Back to question.

Hello,

Just to be sure that this question does not stay unanswered...

So you found the answer yourself :

Did more testing with .NET. Great! It is indeed handling it as a ulong (unsigned long int)
my ulong max value = 18446744073709551615
When incrementing past that value, it just overflows back to zero.
I guess on the server side it's storing the value as a string, and letting the client API decide how to parse the value. Why Java has the same method as (string, long, long) because Java doesn't have ulong.

Let me add more information on this. From the Couchbase Server side, the incr value is a uint64_t.