I have a collection like this.
{
"_id": "6137392141bbb7723",
"email": "brooke@cagle.com",
"lastname": "Cagle",
"firstname": "Brooke",
"phonenumber":9000000001
},
{
"_id": "6137392141bbe30723",
"email": "brooke@cagle.com",
"lastname": "Cagle",
"firstname": "Brooke",
"phonenumber":9000000002`
}
Aim is to update the phonenumber field with 91. i want to insert 91 infront each and every phonenumber of users.
{
"_id": "6137392141bbb7723",
"email": "brooke@cagle.com",
"lastname": "Cagle",
"firstname": "Brooke",
"phonenumber":919000000001
},
{
"_id": "6137392141bbe30723",
"email": "brooke@cagle.com",
"lastname": "Cagle",
"firstname": "Brooke",
"phonenumber":919000000002
}
im trying with updateMany
const doc = await User.updateMany(
{},
{ $set: {
//missing here
}},
{
new: true,
runValidators : true
});```