Skip to content

Why is save() recommended over update methods? #13221

Closed Answered by vkarpov15
vresetnikov asked this question in Q&A
Discussion options

You must be logged in to vote

We'll add a little more info on that. Because you have the document in memory, save() gives you more complete validation (updateOne() can't validate inc, etc.) and better middleware support. So save() gives you access to more features, but updateOne() is faster and atomic.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by vresetnikov
Comment options

You must be logged in to vote
1 reply
@vkarpov15
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants