We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
report link Automattic/mongoose#2262
and mongodb https://docs.mongodb.com/manual/reference/method/db.collection.findAndModify/
export function upsert(req, res) { if(req.body._id) { delete req.body._id; } return Thing.findOneAndUpdate(req.params.id, req.body, {upsert: true, setDefaultsOnInsert: true, runValidators: true}).exec() .then(respondWithResult(res)) .catch(handleError(res)); }
modified return saved document
export function upsert(req, res) { if(req.body._id) { delete req.body._id; } return Thing.findOneAndUpdate(req.params.id, req.body, {new: true, upsert: true, setDefaultsOnInsert: true, runValidators: true}).exec() .then(respondWithResult(res)) .catch(handleError(res)); }
The text was updated successfully, but these errors were encountered:
Feel free to submit a PR for these sorts of things
Sorry, something went wrong.
👍 +1
fix (endpoint:controller): fix findOneAndUpdate syntax
c262211
findOneAndUpdate return modified document now instead of original fixes angular-fullstack#2284
fix (endpoint:controller): fix findOneAndUpdate syntax (#2301)
17ba01b
findOneAndUpdate return modified document now instead of original fixes #2284
Successfully merging a pull request may close this issue.
report link
Automattic/mongoose#2262
and mongodb
https://docs.mongodb.com/manual/reference/method/db.collection.findAndModify/
modified return saved document
The text was updated successfully, but these errors were encountered: