Database

/** Document*/[{persons:[{personId:"61cd90594947be000838f7c1",name:"John Doe",employment:[{employmentId:"61cd90594947be000838f7b2",type:"Full time",salary:1010101}]},{personId:"61cd90594947be000838f7c2",name:"Jane Austin",employment:[{employmentId:"61cd90594947be000838f7b3",type:"Part time",salary:11011111}]},]}]

Query

db.collection.update({},[{$set:{"persons":{$map:{input:"$persons",as:"person",in:{$switch:{branches:[{case:{$eq:[/** ID of the person to move data to*/"61cd90594947be000838f7c2","$$person.personId"]},then:{$mergeObjects:["$$person",{employment:{$concatArrays:["$$person.employment",[{$function:{body:"function(employment) {if(!employment.employmentId) throw Error(\"[employmentId] is not valid!\");return employment;}",args:[{$reduce:{input:{$filter:{input:"$persons",as:"fromPerson",cond:{$eq:["$$fromPerson.personId",/** ID of the data from which data is moved*/"61cd90594947be000838f7c1",]}}},initialValue:{},in:{$mergeObjects:["$$value",{$arrayElemAt:[{$filter:{input:"$$this.employment",as:"employment",cond:{$eq:["$$employment.employmentId",/** ID of the element to move*/"61cd90594947be000838f7b2",]}}},0]}]}}}],lang:"js",}}]],}}]},},{case:{$eq:[/** ID of the person from which to move data*/"61cd90594947be000838f7c1","$$person.personId"]},then:{$mergeObjects:["$$person",{employment:{$filter:{input:"$$person.employment",as:"employment",cond:{$ne:["$$employment.employmentId",/** ID of the data to move*/"61cd90594947be000838f7b2",]}}}}]},},],default:"$$person"}}}},}},])

Result