MongoDB and Mongoose - Create a Model

Tell us what’s happening:

I have completed all the requirements of the question and still it is giving an error saying:
[Error: Cannot read properties of undefined (reading ‘modelName’)]

//here is the section of code
let personSchema = new mongoose.Schema({
name: { type: String, required: true },
age: { type: Number, required: true },
favoriteFoods: [String]

const Person = mongoose.model(‘Person’, personSchema);

###Your project link(s)


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

MongoDB and Mongoose - Create a Model

Link to the editor so we can see your code.

Do you still have the exports at the bottom of the file? It sounds like the model isn’t being exported.