db.customers.updateMany({}, [{ $set : { m : {$arrayElemAt:[{ $split: ["$customerName", " "] },0]}} }], );