Tell us what’s happening:
The challenge test keeps saying “Creating and saving a db item should succeed (Test timed out)” even tough I’ve tried all the possible methods it’s still not working
I’ve tried to see other forums but i they’re not help full.
Thanks.
Your code so far
require('dotenv').config();
const mongoose = require('mongoose')
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });
const { Schema } = mongoose
const personSchema = new Schema({
name: { type: String, required: true },
age: {type: Number},
favoriteFoods: [{type: String}]
});
const Person = mongoose.model("Person", personSchema);
const createAndSavePerson = (done) => {
const Dagim = new Person({name: "Dagim", age: 19, favoriteFoods:["shiro", "Tibs", "Kitfo"]});
Dagim.save(function(err, data){
if(err){
done(err)
}
done(null, data);
})
};
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36
.
Challenge: Create and Save a Record of a Model
Link to the challenge: