Create a Model - Person Schema yields error on FCC

Following these instructions

https://learn.freecodecamp.org/apis-and-microservices/mongodb-and-mongoose/create-a-model/

And using this boiler plate

https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mongomongoose/

I create the model using this code-

var Schema = mongoose.Schema;

var Person = new Schema({  
  name: {type: String, required: true},
  age: {type: Number},
  favoriteFoods : [String]
});

When trying to fetch on FCC, I get this error-

Person Model is not correct

1 Like

Solved with this missing line

var Person = mongoose.model("Person", personSchema);

4 Likes