Bug: Async validation fails (path is required) on Schema.Types.UUID & 'required: true' fields #12991
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
6.9.0
Node.js version
14.17.5
MongoDB server version
6.0.3
Typescript version (if applicable)
4.3.5
Description
Using a UUID with 'required: true' throws a validation error 'Path is required'. It is worth noting that by removing the 'required: true' flag from the fields, you can successfully save the document to the database and the data will be saved as mongodb's UUID type. Maybe I'm doing something wrong, but there is no information in the documentation on how to work with UUID schema type.
Steps to Reproduce
Expected Behavior
The same as when using ObjectID.
The text was updated successfully, but these errors were encountered: