Counter decrement wraps around 0


As per, a counter cannot go below 0.
Thus, in cases when I’m trying to decrement from a zero value, I should get 0.
However, doing .Counter(“my key”, -1, 0, 0) from a zero value, gives me 18446744073709552000.

One observation: I was not creating counter separately, but was using counter with an initial param “0”, thinking it should create a counter for me if not found, similar to how upsert behaves. So, If I’m using Counter (“key”, 1, 0, 0) with a non-existent key, I get the same huge humber. If I create a counter-document before with a 0 value, everything works OK.

I’m on CB 4.5 DP
Go 1.6

Sounds like an issue to me. @brett19 do you agree?

Hey @dennis,
This indeed appears to be an issue, you can track it here:
Cheers, Brett

Perfect, thank you!