Updating Binary document using Couchbase Console

Hello Everyone,

We have a non JSON binary document, I would like to update it but whenever I try to open it in console it gives me error:

Warning: Editing of binary document is not allowed

I tried to append it using append() and it worked, but now I want to change the appended data and I can’t find how to do this.

If anyone can help please.

Thank you.

@emran -

The reason you cannot edit binary data from the Management Console is because the UI would not know how to interpret the bits…it could be anything: picture, text, word doc, etc. There is no way to modify the appended data without recreating the entire value for the key.

-Jeff

Hello Jeff,

Thank you for taking out time to read my query.

The data is a text list. Can you please guide me on how can I recreate the entire value for the key?

Cheers.

Emran

Is there anyone who can assist me with this?

@emran,

If you are trying to work with binary, non-JSON data, you’re going to have to work with it using the SDK from code. There isn’t an option from the Couchbase Console.

Using .Net, you can get the data using bucket.Get<byte[]>(key) or bucket.Get(key), which should return the raw data in the document. Then you can modify it and write it back with an Update or Upsert command.

Brant

Hello Brant,

Thank you for your answer.

I have already done that using .NET SDK and retrieved the data using bucket.Get(key).

The problem is, I got the data prior to appending. The data looked like this with Newline join:

1
2
3
4
5
6
7

When I appended the document, I added “8” to the list. After appending the data, I retrieved it using Get(key) again. but i still received the same data as above without 8.

I used the the console to get the binary data and decoded it using online tool, it showed that 8 has been added. But I am unable to retrieve it using Get.

Is there something I have to do to force refresh the data or something?

Thank you.

Emran

@emran -

If you are using K/V then Get should always retrieve the latest copy from the master. Can you post your code?

Thanks,

Jeff

Hello Jeff,

Thank you for replying.

I accidentally deleted the document, so I had no option to find a way to recreate it. After 15 attempts I managed to recreate the same document as it was in binary.

Thank you for your support.

Emran