N1QL Query for copying data from one bucket to another

You can use UUID() or generate custom key from any field from the document or key

INSERT INTO a (KEY UUID(), VALUE t) SELECT t FROM B AS t;

https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/insert.html#insert-select

Also use Eventing Bulk copy of existing documents

1 Like