Tell us what’s happening:
i dont know what is the probleme please help , you will find my code below
require('dotenv').config();
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });
const personSchema = new mongoose.Schema({
name: { type: String, required: true },
age: Number,
favoriteFoods: [String]
});
const Person = mongoose.model('Person', personSchema);
let p = (done) => {
const person = new Person({
name: "adnene",
age: 22,
favoriteFoods: ["Pizza", "kaftaji"]
});
person.save((error, result) => {
if (error) return done(error);
done(null, result);
});
};
const createAndSavePerson = (done) => {
done(null /*, data*/);
};
const createManyPeople = (arrayOfPeople, done) => {
done(null /*, data*/);
};
const findPeopleByName = (personName, done) => {
done(null /*, data*/);
};
const findOneByFood = (food, done) => {
done(null /*, data*/);
};
const findPersonById = (personId, done) => {
done(null /*, data*/);
};
const findEditThenSave = (personId, done) => {
const foodToAdd = "hamburger";
done(null /*, data*/);
};
const findAndUpdate = (personName, done) => {
const ageToSet = 20;
done(null /*, data*/);
};
const removeById = (personId, done) => {
done(null /*, data*/);
};
const removeManyPeople = (done) => {
const nameToRemove = "Mary";
done(null /*, data*/);
};
const queryChain = (done) => {
const foodToSearch = "burrito";
done(null /*, data*/);
};
module.exports = mongoose.model('Person', personSchema);
/** **Well Done !!**
/* You completed these challenges, let's go celebrate !
*/
//----- **DO NOT EDIT BELOW THIS LINE** ----------------------------------
exports.PersonModel = Person;
exports.createAndSavePerson = createAndSavePerson;
exports.findPeopleByName = findPeopleByName;
exports.findOneByFood = findOneByFood;
exports.findPersonById = findPersonById;
exports.findEditThenSave = findEditThenSave;
exports.findAndUpdate = findAndUpdate;
exports.createManyPeople = createManyPeople;
exports.removeById = removeById;
exports.removeManyPeople = removeManyPeople;
exports.queryChain = queryChain;
###Your project link(s)
solution: https://3000-freecodecam-boilerplate-4bu7maidvle.ws-eu117.gitpod.io
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Challenge Information:
MongoDB and Mongoose - Create a Model