Documents not visible in Couchbase after insertion

I have an issue while inserting BinaryDocuments.
Issue is insert statement seems to be executing without any errors, however I am not able see the records inserted to couchbase.

Here is the code :

String variableKey = "cn_cnt_cc_filter_trandatedur_120|618233701|D/237U/tmf78qptYZhu0jins1HALvj2WtKk7adZj5fNz1ocw6cAt0Aw4YMLE27DKhx7oCaJlBCPCC25ismr5tg==";

int expiry = 31449600;

long documentCas = 1L;

String[] variableInstanceValueFields = {"mtcn", "5001489707881854", "event",
    "SampleDecisionRequest", "timestamp", currentTimestamp.minusDays(40).toString(format),
    "subject", "TestSubject", "subjectvalue", "TestValue"};

VariableInstanceValue variableInstanceValue =
    new VariableInstanceValue(variableInstanceValueFields); 

//here I am Serializing and converting variableInstanceValue  to byte[]

BinaryDocument binDoc = BinaryDocument.create(variableKey, expiry,
          Unpooled.copiedBuffer(variableInstanceValue), documentCas);
        returnBinDoc = dataSource.instanceBucket.insert(binDoc);

 if (null != returnBinDoc) {
      log.monitor("Variable instance {" + variableInstance.getName() + "} " + operation
          + " success for mtcn {" + variableInstance.getValue().getFields().get("mtcn")
          + "} and event {" + variableInstance.getValue().getFields().get("event") + "} took "
          + (System.currentTimeMillis() - startTime) + "ms for size "
          + (variableInstanceValue.length) + " bytes ");
   }

I am seeing returnBinDoc is not null and even not throwing any exception.

The log is getting printed successfully as below:

Variable instance {cn_cnt_cc_filter_trandatedur_120|618233701|D/237U/tmf78qptYZhu0jins1HALvj2WtKk7adZj5fNz1ocw6cAt0Aw4YMLE27DKhx7oCaJlBCPCC25ismr5tg==} inserted success for mtcn {5001489707881854} and event {SampleDecisionRequest} took 221ms for size 132 bytes

Below is the N1QL query and result :

select META(b).id,META(b).Content ,* from VariableData b WHERE Meta(b).id = 'cn_cnt_cc_filter_trandatedur_120|618233701D/237U/tmf78qptYZhu0jins1HALvj2WtKk7adZj5fNz1ocw6cAt0Aw4YMLE27DKhx7oCaJlBCPCC25ismr5tg=='

"clientContextID": "b9fa9a46-ebff-451d-bf0e-5736021f1801",
"signature": {
    "*": "*",
    "Content": "json",
    "id": "json"
},
"results": [
],
"status": "success",

When trying using Get methods, I am getting null :

  BinaryDocument oldBinDoc = dataSource.instanceBucket.get(variableKey, BinaryDocument.class);    

Could anyone explain why is it happening like this?

@manojkumar2505 hm, its very hard to tell from this code snippet. Does it only happen with BinaryDocument ? Why do you need/want that one in the first place? There are other related things around buffer management when using this once, since its the lowest level of abstraction on the Document interface.

If you want to use N1QL you should deal with JSON only and then you have the JsonDocument or RawJsonDocument available.