Skip navigation links

Couchbase Java SDK (2.2.5)

Welcome to the Couchbase Java SDK API Reference!

See: Description

Package Description  

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();

// Open the default bucket
Bucket bucket = cluster.openBucket();

// 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

If you don't know where to go next, start at the CouchbaseCluster class!

Skip navigation links

Copyright © 2015 Couchbase, Inc.