's happening:
Please help me on this model i seems the code is not upto date maybe some can help with model save no longer accepts callback
###Your project link(s)
solution: http://localhost:3000
require(‘dotenv’).config();
const mongoose = require(‘mongoose’);
const { Schema } = mongoose;
mongoose.connect(process.env.MONGO_URI);
const personSchema = new Schema({
name: { type: String, required: true },
age: Number,
favoriteFoods: [String]
});
const Person = mongoose.model(“Person”, personSchema);
exports.PersonModel = Person;
const createAndSavePerson = (done) => {
const person = new Person({name: “david”, age: 21, favoriteFoods: [“pizza”, “moo”]});
person.save(function(err, data) {
done(null, data);
});
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Challenge Information:
MongoDB and Mongoose - Create and Save a Record of a Model