Skip to content

Commit

Permalink
fix(endpoint:controller): fix findOneAndUpdate syntax
Browse files Browse the repository at this point in the history
fixes #2221
  • Loading branch information
Awk34 committed Sep 13, 2016
1 parent c188229 commit 1c2a219
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/endpoint/basename.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 1c2a219

Please sign in to comment.