JSON data stored as base64


#1

Hi,
Recently we have upgraded our application code from Couchbase 1.4 SDK to 2.5 SDK version, and Couchbase server 4.1 to 5.1.

I tried below options to insert the datas into Couchbase. Here irrespective of json/non-json data, all the datas are inserted with the meta type as base64. Through couchbase views, i came to know that the meta type of the document as base64. Please help me in setting as json in case of json data.

Json File(savedSelectionsRqInstnc.json):
{
“creator”: "ismail.iqbal.ap@nielsen.com",
“promptName”: “Periods”,
“dataScopeId”: “18ABCED154856935236454”,
“hiddenPrompt”: false,
“minSelections”: 1,
“valid”: true
}

Code:
Object value = IOUtils.toString(this.getClass().getResourceAsStream("/json/savedSelectionsRqInstnc.json"));

1)JsonDocument doc = JsonDocument.create(_key, JsonObject.fromJson(value.toString()));
bucket.insert(doc);
//here am seeing the json data in the web console. However through view, am seeing the meta.type as base64.

  1. RawJsonDocument doc = RawJsonDocument.create(_key, value.toString());
    bucket.insert(doc);
    //here am seeing the json data in the web console. However through view, am seeing the meta.type as base64.

  2. LegacyDocument doc = LegacyDocument.create(_key, value);
    bucket.insert(doc);
    //here am seeing the json data in the web console. However through view, am seeing the meta.type as base64.

  3. JsonStringDocument doc = JsonStringDocument.create(_key, value.toString());
    bucket.insert(doc);
    //here am seeing the warning: Editing of binary document is not allowed.
    I gone through the source code as well. There am seeing the json flag is passed as false:

View output:

Thanks


#2

With views in Couchbase server 5.1, we are always getting the meta.type as base64. Means Couchbase SDK is not playing any role here. Hence please close this ticket. Thanks