The problem here is that I'm only updating the first document with the given email but I want to update all the emails he found with this email so I want to use find() but I don't know what to write to update all documents that was found
router.route("/Updateinfo").post((req, res) => {
console.log("updateinfo");
console.log(email);
const z = req.body.Name;
const d = req.body.Password;
const s = req.body.Email;
const v = req.body.Type;
console.log(z);
if(v!="admin"){
User.findOne({Email: email}, function (err, user) {
user.Name = z;
user.Password = d;
user.Email = s;
user.Type = v;
user.save(function (err) {
if(err) {
console.error('ERROR!');
}
});
});