Counter
A counter backed by a document on Couchbase Server.
Create an instance using Collection.counter.
Counter operations are atomic with respect to a single Couchbase Server cluster, but not between clusters when Cross-Datacenter Replication (XDCR) is used.
The content of a counter document is a single JSON integer with a minimum value of zero and a maximum value of 2^64 - 1.
A counter decremented below zero is reset to zero.
A counter incremented above 2^64 - 1 overflows (wraps around).
Counter values above 2^53 - 1 may have interoperability issues with other languages that store all numbers as floating point values.
See also
Functions
Link copied to clipboard
Atomically decrements by one the current value.
Link copied to clipboard
Atomically increments by one the current value.
Link copied to clipboard
Sets the value of the counter.