Created
November 12, 2012 20:27
-
-
Save jasonsirota/4061669 to your computer and use it in GitHub Desktop.
homepage for matt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//instantiate the client | |
List<URI> uris = new LinkedList<URI>(); | |
uris.add(URI.create("http://localhost:8091/pools")); | |
CouchbaseClient client = new CouchbaseClient(uris, "beer-sample", ""); | |
//add a doc | |
String key = "beer_Wrath"; | |
String value = "{'name':'Wrath','type':'beer','category':'Belgian and French Ale'}"; | |
client.set(key, 0, value).get(); | |
//define the query | |
View view = client.getView("beer", "by_name"); | |
Query query = new Query().setKey("Wrath").setIncludeDocs(true); | |
//query the view and output | |
ViewResponse result = client.query(view, query); | |
System.out.printf("Query returned %s docs", result.size()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment