Tell us what’s happening:
In this lesson:
MongoDB and Mongoose - Create a Model, I had an error so I copied/paste the solution.
And there is still a error message:
Creating an instance from a mongoose schema should succeed
Your code so far
////////////top of the page//////////
try{
var mongoose = require(‘mongoose’);
var Schema = mongoose.Schema;
} catch (e) {
console.log(e);
}
////////////top of the page//////////
const personSchema = new Schema({
name: { type: String, required: true },
age: Number,
favoriteFoods: [String]
});
console.log(“model creation…”)
var Person = mongoose.model(“Person”, personSchema);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
.
Challenge: MongoDB and Mongoose - Create a Model
Link to the challenge: