I am trying to use Java SDK to upsert a document into Couchbase Server Community Edition installed locally. I use following statements to
JsonObject jo = JsonObject.fromJson(jsonString); jDoc = JsonDocument. create( documentId ,jo); bucket.upsert(jDoc);
I generate the document id prior to
upsert operation as follows:
JsonLongDocument ctrDoc = bucket.counter( documentType,1,1); Long ctr = ctrDoc.content(); documentId = documentType + ctr.toString();
The code works fine but when I log in to Couchbase Server, it inserts two documents. One correct document and another one with just a pre-fix of the documentId and a document number. See the attache screenshot
Can someone help?
Thanks in advance