I am trying to do insert-select in N1QL. It is part of longer process…
I am trying to copy all docs of one type and modify them. I was thinking about saving them with a different key (and if possible type).
That example copies all values from one bucket to the other. How can I take just some cols? Can I also change the key of docs?
I was trying something like this:
INSERT INTO carly_test (key docId, value _v)
select site, max(docId) dealDocId, ‘uDeal’ docType, ‘uDeal::’ || site docId
from carly_test as _v
where docType like 'dealer%'
group by site
In insert-select example in your documentation it is confusing to me that you named have 3 things named _v: bucket alias, value parameter and ?. Is the 3rd thing (second col in select statement) a reference to all cols in bucket? Or some special function?
INSERT INTO bucket1 (key _k, value _v) SELECT META().ID _k, _v FROM bucket2 _v;