Reputation: 43
I'm studying MongoDB(mongoose)
.
So I've a question on Model.findByIdAndRemove()
and Model.findByIdAndDelete()
of Mongoose
- what's the difference between both of them.
What's the proper use of each?
Upvotes: 4
Views: 2884
Reputation: 4443
findByIdAndDelete & findByIdAndRemove are same other than findOneAndRemove uses findAndModify with remove functionality with time to execution of particular amount of operations.
by doing comparison findByIdAndDelete is always better than findByIdAndRemove.
Upvotes: 5