MongoDB and Mongoose - Create and Save a Record of a Model

Tell us what’s happening:
Describe your issue in detail here.
Creating and saving a db item should succeed (Test timed out)

Your project link(s)

https://boilerplate-mongomongoose-2.amanhussain4.repl.co

require(‘dotenv’).config();
const mongoose = require(‘mongoose’)

mongoose.connect(process.env[‘MONGO_URI’])

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

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

const createAndSavePerson = (done) => {
var aman = new Person({name : “Aman” , age : 23, favoriteFoods : [“cake” , “dfsdf”] })
aman.save((err,data) =>{
if(err){
return console.error(err);
}
done(null,data)
})
};
solution: boilerplate-mongomongoose (2) - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36

Challenge: MongoDB and Mongoose - Create and Save a Record of a Model

Link to the challenge:

Im having the same problem, tried on repl and also on my local server (which ive been doing since the beginning). Did you fix it? Anyone can help?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.