Create a model using mongoose stuck forever

I did this

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

However, when I test it, it says person model is not correct. What am I doing wrong?

How are you testing it? When you say the model is not correct what does that mean?

Could you provide an error log?
Maybe a bit more context around your testing.

If we can look at the errors, we can maybe figure out what went wrong :slight_smile:

@psbyron3 My app does not indicate any errors. However, when I paste my app’s link to finish the exercise, it says that the model is not correct. I implemented what has been asked for. What am I missing out?

Are you able to create a Person object on your own?
Did you pass your schema instance to a model?

https://mongoosejs.com/docs/2.7.x/docs/model-definition.html

I know this is sort of old, but I am going to post it here since I found the solution to get the test to pass but it isn’t made very clear by the instructions given in the challenge.

So, what the challenge is asking for, is for you to set up a Schema with the given the properties, and then to create a model from that Schema.

First, it’s easier to create a local instance of Schema:

const Schema = mongoose.Schema;

Then, create a Schema with the given properties:

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

…finally, create a model based on that Schema:

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

Then, your tests should pass.