Issue
I’m opening a new issue on this because it is using GitPod. I am experiencing the same issue as this post last September. My submission is tested for a few moments, then gives a timed out error. I have confirmed that the connection is working and that the schema/model are created per specifications.
Code
let personSchema=new mongoose.Schema({
name: {type: String, required: true},
age: Number,
favoriteFoods: [String]
});
// A model is a document instance.
let Person=mongoose.model('Person',personSchema);
const createAndSavePerson = (done) => {
// Creating a document instance of Person
let Adrian=new Person({name:'Adrian',age:15,favoriteFoods:['Pizza','Apple Pie']});
Adrian.save(function(error,data){
if(error){
console.log(error);
}else{
done(null,data);
}
});
};
solution: https://3000-freecodecam-boilerplate-4dckhpqfa11.ws-us108.gitpod.io
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
MongoDB and Mongoose - Create and Save a Record of a Model