Couchbase Java SDK (2.7.18)
Welcome to the Couchbase Java SDK API Reference!
Here is a simple hello world that you can run and verify your installation works:
// Connect to a cluster on localhost Cluster cluster = CouchbaseCluster.create(); cluster.authenticate("username", "password"); // Open the default bucket Bucket bucket = cluster.openBucket("myTestBucket"); // Create a user and insert it JsonObject user = JsonObject.empty() .put("firstname", "Walter") .put("lastname", "White") .put("job", "chemistry teacher") .put("age", 50); JsonDocument doc = JsonDocument.create("walter", user); JsonDocument response = bucket.upsert(doc); // Read it back out JsonDocument walter = bucket.get("walter"); System.out.println("Found: " + walter); // Disconnect from the cluster cluster.disconnect();
If you don't know where to go next, start at the CouchbaseCluster class!