samedi 28 février 2015

error message for mongoose schema type mismatch

I have the following mongoose schema definition for a property amount.


If I don't pass a number or pass something less than 10, I am able to get the correct error messages as specified.


But I get a blank error message if the type specified is not number. For e.g. if I pass 'somestring'. It rightfully errors out on save, but with no message. Where can I specify the error message for type mismatch?


var ExpenseSchema = new Schema({



amount: {
type: Number,
required: 'Please fill Expense amount',
min: [10, 'Please enter at least 10'],
....

Aucun commentaire:

Enregistrer un commentaire