November 2015
Beginner to intermediate
248 pages
5h 24m
English
There are times when we would like to have some counters defined to keep a track of documents. For example, if we want to track the sales of the book, Learning Couchbase, we can define a counter and increment it by 1 whenever someone buys the book. A counter can also be used to keep a track of users visiting the web page. It can be done as shown here:
theBucket.counter("NumberOfCopies", 1);Initially, when the NumberOfCopies counter is not present in the bucket, it will be assigned a default value of 0. Here, the counter, NumberOfCopies, is increased by a value of 1.
Read now
Unlock full access