Sub Document insertion fails when value has binary data



I am trying to insert a sub-document having a binary data, but the insertion is failing.
The document id “key” already exist and is a json document.
{ “hello”: “world” }

– Code –
printf(“Adding new ‘binary’ path to document\n”);
LCB_CMD_SET_KEY(&cmd, “key”, 3);
cmd.specs = &spec;
cmd.nspecs = 1;

char *path = "binary";
LCB_SDSPEC_SET_PATH(&spec, path, strlen(path));
char buf[5];
LCB_SDSPEC_SET_VALUE(&spec, buf, 5);

rc = lcb_subdoc3(instance, NULL, &cmd);
assert(rc == LCB_SUCCESS);

– Error –
Got callback for SDMUTATE… Status: 0x44. Value:


JSON specification does not allow binary data. And 0x44 code says that. Check with lcb_strerror.


Java SDK does allow the same and seems to peforming base64 encoding to the json attribute containing bytearray as value. C SDK, should also be providing the support for the same