Put a Schema with mongoose into my replit

Hi, i’m approaching this lesson, so i have to create a Schema, in my replit i wrote into myApp.js this code to add the Schema:

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

const ThePerson = mongoose.model("ThePerson", personSchema);

i’ve written it following this. When i had finisched writting it, i ran the terminal and no errors appears, but when i putted the replit’s link on the lesson page to check the result, i couldn’t pass the test! Hope for a hint!

1 Like

I think i’ve found the error! in the lesson you told to create a variable (model) called Person from the personSchema, so in my code i edit the variable ThePerson with Person, but there is a fact, in myApp.js there already was a variable Person by default, so i ask you, if i can’t edit the default varaible Person, and i need to call the new model Person too in order to pass the test, how should i do? I tryed to rename the default variable and change it all long in myApp.js but i didn’t succeded, hope for your help!

Solved, here’s my code, it just needed to change the default variable Person in its first presence in the code of myApp.js!


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

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








let Person11;  //<-----this is bad guy 
1 Like