Hi,
I am starting to explore Couchbase Server (4.6) and the C SDK (v2.8.1) running on Ubuntu 14.04.
My question is the opposite of this post:
I want to store a binary / blob document in the ‘default’ bucket, where my code does the following:
std::string key("imci_cc_code2");
unsigned char dataBytes[] = { 0x0a, 0x0b };
lcb_CMDSTORE scmd = { 0 };
scmd.operation = LCB_SET;
scmd.flags = x; // I think this is for app usage, though I've tried values 0, 1, 2, 3 just in case it means something to CB
LCB_CMD_SET_KEY(&scmd, key.c_str(), key.size());
LCB_CMD_SET_VALUE(&scmd, &dataBytes[0], sizeof(dataBytes));
lcb_error_t rc = lcb_store3(instance, NULL, &scmd);
The raw bytes are stored OK:
$ ./build/bin/cbc cat imci_cc_code2 -U couchbase://localhost/default | hd
imci_cc_code2 CAS=0x14eafedeae780000, Flags=0x3. Size=2
00000000 0a 0b |..|
00000002
And I have a second document stored in the ‘default’ bucket that is valid json:
$ ./build/bin/cbc cat bar -U couchbase://localhost/default | hd
bar CAS=0x14eaff95d01e0000, Flags=0x0. Size=20
00000000 7b 22 76 61 6c 75 65 22 3a 22 62 61 72 56 61 6c |{"value":"barVal|
00000010 75 65 22 7d |ue"}|
00000014
But when viewing the “Data Buckets / default / Documents” bucket using the web page, it doesn’t list any documents in the bucket. It simply shows the attached picture which has a read error message that simply says:
“Error: ()”
Is my code wrong?
Thanks!