-2
you can use the methods findOneAndUpdate() or findByIdAndUpdate() to search for a field and change it
const categoria = {name: req.body.name, ...}
categorias.findOneAndUpdate({id: req.body.id}, categoria )
More in : Mongoose queries
-2
0
you can use the methods findOneAndUpdate() or findByIdAndUpdate() to search for a field and change it
const categoria = {name: req.body.name, ...}
categorias.findOneAndUpdate({id: req.body.id}, categoria )
More in : Mongoose queries
Thank you so much for your help.
0
the . Lean() method after . findOne() does not allow you to use . save() and also you have a comma after the name
categorias.nome = req.body.nome,
I believe that after these modifications your code will work
Thank you very much, that solved.
Browser other questions tagged javascript mongodb mongoose
You are not signed in. Login or sign up in order to post.
save is insert new record or update another record?
– novic
Include the code in the body of the question and not in a print for easy searching.
– Marcell Alves