-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug while creating document #14413
Comments
I’m guessing it’s because your document is passing in an empty string for description. A required string means it has a value (and the empty string is not considered a value). You have a few options I think including.
probably other solutions too but those are the two main ones I know about. |
I agree with @sean-daley . I guess what you're looking for is |
My question is. In the line |
Empty string // Allow empty strings to pass `required` check
mongoose.Schema.Types.String.checkRequired(v => v != null); |
Prerequisites
Mongoose version
8.0.3
Node.js version
v21.5.0
MongoDB server version
7.05
Typescript version (if applicable)
No response
Description
I tried to create document but it gave error Error - ValidationError: Description: Path
Description
is requiredSteps to Reproduce
Model
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: