Closed AkpoFlash closed 4 years ago
"require" is invalid. Use "required" instead.
Yes, of course, "require" is invalid. I use "required" in my code, but just did the mistake when wrote code here. Sorry for this.
Anyway, I have the same error:
TypeError: Invalid schema configuration: `True` is not a valid type at path `title.required`. See http://bit.ly/mongoose-schematypes for a list of valid schema types.
Also, I have the same error with any default value, for example:
@Prop({ default: 1 })
views: number;
error:
TypeError: Invalid schema configuration: `1` is not a valid type at path `views.default`. See http://bit.ly/mongoose-schematypes for a list of valid schema types.
This problem still relevant, maybe you reopen the issue?
+1, same problem here.
Please, use our Discord channel (support) for such questions.
If you're getting this error, it means you're passing the invalid property options to the @Prop()
decorator. Make sure your @nestjs/mongoose
version is 7.0.1 (the latest published one). I've just tested both default
and required
options and it works properly.
I've updated the sample/06-mongoose
in the nestjs
repo to use the latest version as well (just in case)
I'm submitting a...
Current behavior
When I want to describe my schemas like this:
Then I execute
and I have this error message:
Expected behavior
Run/build the project without this error
Environment