Hi I have one document which was already existed in Couchbase DB. In the bucket the “ID ==abc”. And I want to generate same document, but ID should be “abc1”. I don’t understand how to use INSERT SELECT query. Can anyone please explain.
I got following query
INSERT INTO bucket_name (key k, value _v) SELECT META().id || new AS _k, { “myid” : t.id } _v FROM bucket_name t;
Use INSERT INTO SELECT statement. Example 8, 13-15 athttps://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/insert.html
INSERT INTO bucket_name (key _k, value _v)
SELECT META().id || new AS _k, t AS _v FROM bucket_name t
WHERE ......;
Thank you so much . It worked.