Search code examples
javaspring-bootcouchbasespring-data-couchbasecouchbase-java-api

Spring Data for Couchbase - increments the numerical value of special counter document


I want to increments the numerical value of special counter document, Obtain the id from counter document and increment it

com.couchbase.client.java.Bucket bucket;
JsonLongDocument joCounter = bucket.counter(docKey, 1);

but I don't know how to instantiate the bucket object


Solution

  • Our documentation for the Java client shows how to connect to a Couchbase cluster and open a bucket:

    https://docs.couchbase.com/java-sdk/current/start-using-sdk.html