Mongoose Model Custom Error Message for Enums
问题 I would like to customize the validation messages that my Mongoose Models produce. I tend to NOT put my validations (e.g. required) on the schema object directly because there is no freedom to have custom error messages. e.g. sourceAccountId: { type: Schema.ObjectId, require: true, ref: 'Account' } instead I do the following. sourceAccountId: { type: Schema.ObjectId, ref: 'Account' } ConnectionRequestSchema.path('sourceAccountId').required(true, 'Source Account is required.'); I have been