Split the customerName into lastName..the last surname letter..the last index

PHOTO EMBED

Fri Apr 30 2021 11:47:12 GMT+0000 (Coordinated Universal Time)

Saved by @tapasdash #nodejs #mongoose #mongodb

db.customers.updateMany({},
  [{ $set : { n : {$arrayElemAt:[{ $split: ["$customerName", " "] },1]}} }],

);
content_copyCOPY