How to do validations before saving the edited data in mongoose?
For example, if sample.name already exists in the database, the user will receive a som
sample.name
If you're searching by an unique index, then using UserModel.count may actually be better for you than UserModel.findOne due to it returning the whole document (ie doing a read) instead of returning just an int.