Unable to copy binary data from on bucket to another

Hi folks,I have this script which I use to copy documents from default to shared bucket
UPSERT INTO shared (KEY id, VALUE default)
SELECT meta().id, default FROM default.
Am facing an issue and the issue is that some values which are stored as binary in default bucket change to a string when copied to shared bucket using the above script.**How can I ensure that the datatype of the value is the same across these two buckets(default and shared)?**The picture below shows the difference between the two buckets.

N1QL is made to work with JSON documents, not raw binary data. It’s not surprising that it chokes on an attempt to use it to move binary data from one bucket to another.

If you want to move this sort of binary data, check out the cbtransfer tool.

https://docs.couchbase.com/server/current/cli/cbtransfer-tool.html

1 Like

As @johan_larson mentioned N1QL only works on JSON documents.
You can also try

CREATE primary index
FROM SDKs
       SELECT all document keys
        Loop the document keys
               GET the document from data node
               Put into destination bucket
1 Like