Custom Error Messages with Mongoose

前端 未结 8 505
旧巷少年郎
旧巷少年郎 2021-02-01 04:06

So according to the mongoose docs, you are supposed to be able to set a custom error message in the schema like so:

 var breakfastSchema = new Schema({
  eggs: {         


        
8条回答
  •  春和景丽
    2021-02-01 04:53

    You can rewrite error messages in source, so in node modules. Here is a path for do it: YOUR_PROJECT/node_modules/mongoose/lib/error/validation.js

    then you dont have problem with any additional package for that.

提交回复
热议问题