Enum object syntax does not work on a number path #10648
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
According to mongoose docs there are two ways to set a validator message: using array syntax or using object syntax.
Currently, the enum object syntax is not working on a number path.
If the current behavior is a bug, please provide the steps to reproduce.
Causes the error:
Error: Review validation failed: rating: `5` is not a valid enum value for path `rating`.
What is the expected behavior?
To be able to use object syntax to set an enum validator for numbers.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js: v14.17.3
Mongoose: v6.0.3
MongoDB: irrelevant
The text was updated successfully, but these errors were encountered: