Compacting append


I’m appending strings using Append()
When data is saved it is in binary form in the doc’s value.
It happens that the length of the binary doc is longer than the length of it represented as plain text.
Given that it is illegible and longer, Is there a better way to use Append to append strings ?
If the string represent indexes, can I append integers ?
Can I append to create a HashSet ? HashSet ?


I cannot even check it in the console: "Warning: Editing of binary document is not allowed "


Append is fairly rudimentary op. There are only two flavors supported: appending strings or bytes. You may have better luck with bytes, because you have a bit more control.

The Console only allows valid JSON to be viewed; anything else is stored as binary on the server and the UI wouldn’t know how to represent it (i.e. is it a string or int or something else?).

CB doesn’t support a data structure like storage, for example, an integrated hash set. We have talked about adding this, but we don’t having anything yet. Note you can store stuff in JSON this way, though.




I think that the console shows Base 64 encoded strings in the documents view:

But in a document view:

In this example, QSxBLEIsQyw= is 12 bytes long
where the original string is A,A,B,C, only 8 bytes long (50% longer)

So, my question was whether I can append a string rather than its coded representation so that I’ll benefit from a readable text and a less memory and I guess that the answer is no.


Ping …

@itay -

Non-JSON values will be stored as binary blob (as you have seen) and you cannot view them from the document editor in the Management Console. The console tries to display the document as JSON, if it cannot it encodes it as base64 to display in the UI.

So, the answer is no, you cannot append two valid JSON objects as a string. However, in future CB versions this will likely change when there is support for modifications to individual elements of a document.



I don’t want to append two valid JSON objects.
I just want to inspect them as they are basically strings and not binary.

Have a look at the “cbc” utility installed with libcouchbase. The console renders the data as views provides it, and that’s only as base64, even though it’s not stored as base64.

Couldn’t find docs about cbc utility.
I guess I’ll have to write my own extension to the console basic capabilities

I’m not sure why you couldn’t find docs. I used the search box on and found it straight away. It’s covered in the libcouchbase download and install and the man page is in the API references.

Let me know if there’s something else we need to do to highlight it in the docs better for other users.

I looked here

I don’t understand how it is related to appending