Created
January 14, 2012 20:20
-
-
Save ingenthr/1612750 to your computer and use it in GitHub Desktop.
Accessing Couchbase 2.0 views
This file contains hidden or 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
| URI aserver = new URI("http://10.1.6.171:8091/pools/"); | |
| List<URI> servers = new ArrayList<URI>(); | |
| servers.add(aserver); | |
| CouchbaseClient cbc = new CouchbaseClient(servers, "default", ""); | |
| System.err.println(cbc.get("MattIngenthron")); | |
| View view = cbc.getView("$dev_testing", "atest"); | |
| Query myQuery = new Query(); | |
| myQuery.setRange("Bob", "N"); | |
| ViewFuture queryResultsFuture = cbc.query(view, myQuery); | |
| ViewResponseWithDocs queryResults = queryResultsFuture.get(); | |
| Iterator<RowWithDocs> iterator = queryResults.iterator(); | |
| System.err.println("Found " + queryResults.numRecords() + " docs."); | |
| while (iterator.hasNext()) { | |
| RowWithDocs next = iterator.next(); | |
| System.err.println(next.getDoc()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment