question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

I’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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AkpoFlashcommented, May 16, 2020

This problem still relevant, maybe you reopen the issue?

1reaction
kamilmysliwieccommented, May 13, 2020

“require” is invalid. Use “required” instead.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found