Reputation: 251
I have mongodb collection with below documents.
I wanted to update phone = 9876054321 where Email = [email protected] in Nodejs mongoose. My results should be like below.
Upvotes: 0
Views: 233
Reputation: 5051
if the Model created correctly, just try
await Model.updateMany({ Email : "[email protected]" }, { phone : 9876054321 });
let result = await Model.find({Email : "[email protected]"}).lean();
console.log(result)
Upvotes: 1