Person model is not correct: mongoose

Person model is not correct: mongoose


This is my code

and this is the challange


Don’t use new mongoose.Schema

Use new Schema



The challenge is asking you to specify a default value, like this:

const schema = new Schema( {
  name: {
    type: String,
    required: true
  age: Number,
  favoriteFoods: {
    type: [ String ],
    default: 'Pizza, of course'
} );


mongoose.Schema should be required unless you save mongoose.Schema into a new variable named Schema, like this: const Schema = mongoose.Schema. Otherwise Node won’t know what Schema is, right?


Actually you are right,

I assumed he defined mongoose.Schema in to Schema already. Good catch, therefore @seinfeld70 you can ignore what I said above.


I always make a copy to a new variable too. It looks cleaner to me :slight_smile: