How to store a JSON file in to CouchBase server by using java as client?

Hi,

Basically I want to store one JSON file which contains json data into couch base server by using java clinet?
Some one can help me out in this regard.

Thanks in advance
Koti

1 Answer

« Back to question.

I think you can just read file content into the string and pass to to set() method. The example below taken from README file in the repository: https://github.com/couchbase/couchbase-java-client#using

List<URI> baseList = Arrays.asList(
  URI.create("http://192.168.0.1:8091/pools"),
  URI.create("http://192.168.0.2:8091/pools"));
 
CouchbaseClient client = new CouchbaseClient(baseList, "default", "");
 
OperationFuture<Boolean> setOp = client.set("key", "{\"name\":\"Couchbase\"}");