TypeError: Invalid schema configuration: `True` is not a valid type at path `view.require`. See http://bit.ly/mongoose-schematypes for a list of valid schema types.
See original GitHub issueI’m submitting a…
[ ] Regression
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When I want to describe my schemas like this:
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
@Schema()
export class Article extends Document {
@Prop({ require: true })
title: string;
@Prop()
author: string;
@Prop()
body: string;
@Prop()
hidden: boolean;
}
export const ArticleSchema = SchemaFactory.createForClass(Article);
Then I execute
nest start
and I have this error message:
TypeError: Invalid schema configuration: `True` is not a valid type at path `view.require`. See http://bit.ly/mongoose-schematypes for a list of valid schema types.
Expected behavior
Run/build the project without this error
Environment
Nest version: 7.1.2
For Tooling issues:
- Node version: 14.2.0
- Platform: Mac
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Mongoose validation err: Invalid schema configuration
Trying to model a relationship between collections by embedding documents but when validating in the schema and setting "required" to ...
Read more >Invalid schema configuration: `True` is not a valid type at path ...
Mongoose gives a run-time error when I am using my schema to define immutable: true . Here is a snippet of my schema:...
Read more >Solved: "`model` is not a valid type within the array" Mongoose ...
If you are getting the Mongoose error " Invalid schema configuration: `model` is not a valid type within the array " then it...
Read more >Automattic/mongoose - Gitter
hey guys, I'm getting a type error with schema not being recognized as a ... See http://bit.ly/mongoose-schematypes for a list of valid schema...
Read more >Mongoose v6.8.1: Validation
If an error occurs, your Model#save callback receives it; Validation is customizable. const schema = new Schema({ name: { type: String, required: true...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This problem still relevant, maybe you reopen the issue?
“require” is invalid. Use “required” instead.