79543567

Date: 2025-03-29 16:45:50
Score: 0.5
Natty:
Report link

Instead of replacing the entire contact object, update only the email field using MongoDB's dot notation as contact.email

await Client.findByIdAndUpdate(
    id,
    { $set: { "contact.email": <New_Email> } }, 
    { new: true, runValidators: true } // returns updated doc & enforce schema validation
);

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Jasvinder singh