Create a model using mongoose stuck forever

Create a model using mongoose stuck forever
0

#1

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

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?


#2

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:


#3

@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?


#4

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