N1QL Upsert question

Hi Team,
Currently i am using N1QL query to move data from one bucket to another, the query is below,
UPSERT INTO poc-target (KEY _k, VALUE _v) SELECT META().id _k, _v from masterdata-source _v where meta().id=‘Cus::1111_999’

Now i want to change something in one of the field coming from SELECT statement( like a filed called modifiedtime while inserting in the target. The reason for using UPSERT to make sure we are not worrying whether INSERT or UPDATE.

Is there a way for this?


UPSERT INTO  `poc-target`  (KEY _k, VALUE _v1) 
SELECT META().id _k, OBJECT_PUT(_v, "modified_time", NOW_STR()) AS _v1 from  `masterdata-source`  _v where meta().id=‘Cus::1111_999’

can we add 1 more field here, like “modified_by”?

OBJECT_PUT(OBJECT_PUT(_v, "modified_time", NOW_STR()), "modified_by","xyz")


OBJECT_CONCAT(_v, {"modified_time":NOW_STR(), "modified_by":"xyz"})

You have document key already. you can use USE KEYS.

UPSERT INTO  `poc-target`  (KEY _k, VALUE  OBJECT_CONCAT(_v, {"modified_time":NOW_STR(), "modified_by":"xyz"})  ) 
SELECT META().id _k,  _v from  `masterdata-source`  _v  USE KEYS "Cus::1111_999"