// Assigning { new: true } will let the doc always contain updated data from the database
Book.findOneAndUpdate({ _id: bookId }, { $set: updatedParams }, { new: true })
.then(doc => res.json(doc))
.catch(error => next(error));
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.