diff --git a/templates/endpoint/basename.controller.js b/templates/endpoint/basename.controller.js index 364879ecf..63279b423 100644 --- a/templates/endpoint/basename.controller.js +++ b/templates/endpoint/basename.controller.js @@ -101,7 +101,7 @@ export function upsert(req, res) { delete req.body._id; } <%_ if(filters.mongooseModels) { -%> - return <%= classedName %>.findOneAndUpdate(req.params.id, req.body, {upsert: true, setDefaultsOnInsert: true, runValidators: true}).exec()<% } %> + return <%= classedName %>.findOneAndUpdate({_id: req.params.id}, req.body, {upsert: true, setDefaultsOnInsert: true, runValidators: true}).exec()<% } %> <%_ if(filters.sequelizeModels) { -%> return <%= classedName %>.upsert(req.body, { where: {