Skip to content

Instantly share code, notes, and snippets.

@trillionclues
Created April 20, 2023 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trillionclues/6ffdf6df7202ba05dc1a39e3936f31b3 to your computer and use it in GitHub Desktop.
Save trillionclues/6ffdf6df7202ba05dc1a39e3936f31b3 to your computer and use it in GitHub Desktop.
Gist to send and update specific node status by matching the Id in a database
// PUT ? UPDATE SPECIFIC NOTES
exports.dashboardUpdateNote = async (req, res) => {
try {
await Note.findOneAndUpdate(
{ _id: req.params.id },
{ title: req.body.title, body: req.body.body, updatedAt: Date.now() }
).where({ user: req.user.id })
res.redirect('/dashboard')
} catch (error) {
console.log(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment