I am getting this error while I am running my express app with mongoose. there is everything is all right in code part. but still now this error is showing. I can not identify exactly where the problem is.
CODE: status: { enum: ["active", "inactive"], default: "active" }
CONSOLE:
throw new TypeError(Invalid schema configuration: \
${name}` is not `
^
TypeError: Invalid schema configuration: Active
is not a valid type at path status.default
.
CodePudding user response:
Well i didn't get much the problem but seems like you have a problem on declaring the enum values you can try to structure like this
status: {
type: String,
enum: ['active','inactive'],
default : 'active'
}
If this code didn't solve your problem could share the code for more information