Lookup document with bucket.insert pure string ends in duplicate quotes

Hey guys,

just started with couchbase a couple of days ago and I’m really enjoying it, so thanks for that :wink:
I’m building an intranet using vue.js.

I really like the idea of lookup document and everything works so far, only that I’m not able to use bucket.insert from Node SDK to create a pure string document problem seems to be JSON.stringify which the sdk uses internally as far as I understood?
Because when I enter a string (in this case I’m passing a variable containing a string) the document ends up as binary, how can I store it as normal human readable string?
using the couchbase ui in the browser I’m able to enter a string in quotes like “user::1”

my workaround for now is to wrap the string in square brackets so it’s a json compatible array
but then I have to get it by referencing the first index…

so it seems to work now…updated node sdk from 2.2.2 to 2.3.3…not sure if it works because of the update or i might did anything wrong…but now it works
though still bucket.insert stores the string as binary…but i can compare it using bucket.get’s result.value :slight_smile:

Hey @Can,

The Node.js SDK (as all the SDKs) store strings in their binary representation rather than JSON representation for space-saving purposes (JSON strings are wrapped in quotes, and must be escaped). Unfortunately, the Couchbase Web UI displays these strings as binary as its not a simple task to differentiate between a string and a stream of bytes. We hope this will fixed soon.

In the meantime, perhaps it may be ideal for you to store JSON documents? If you need any storage modelling help, let us know what kind of data your storing and we would be happy to help!

Cheers, Brett

thanks for the clarification @brett19, good to know!
After understanding that it works it was fine…until I decided to store more information along the document id in my lookup docs, e.g. the user agent for authentication tokens so I already switched back to json.
but thanks anyways, like the responsive community :slight_smile: