slider_value: {
type: Number,
required: false,
},
This is the Mongoose schema for one of the fields in my MongoDB model.
Is it possible to specify the acceptable integer values in this field?
for example, this field may only accept the integers from 1 to 10.
2
Answers
You are looking for
min
andmax
validators:There are min and max validators, and you should also check for isInteger