String bucketName = "bucket";
List<String> nodes = Arrays.asList("node1","node2"); // IP or hostname of one or more nodes in the cluster
Cluster cluster = CouchbaseCluster.create(nodes);
Bucket bucket = cluster.openBucket(bucketName);
//check for a document by its ID
String id="bucket_collection_user_123456";//document id
boolean exists=bucket.exists(id);
if(exists){
System.out.println("Docuemnt exists");
}
bucket.close();
cluster.disconnect();