TypeError: Invalid schema configuration: `isAdmin.isAdmin` schematype definition is invalid

130 Views Asked by At

The server is crashing because of the line isAdmin: { isAdmin: boolean, default: false },

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

It's probably crashing because isAdmin is not valid field of mongoose schema, instead your schema declaration schould looks like

new mongoose.Schema({
...// rest of your schema
isAdmin: {type: Boolean, default: false}
})

so simply replace isAdmin: boolean with type: Boolean