Tell us what’s happening:
unable to pass this test
Your code so far
require('dotenv').config();
//let Person;
//const createAndSavePerson = (done) => {
//done(null /*, data*/);
//};
//const createManyPeople = (arrayOfPeople, done) => {
// done(null /*, data*/);
//};
//const findPeopleByName = (personName, done) => {
// done(null /*, data*/);
//};
//01
const mongoose=require("mongoose");
let uri ='mongodb+srv://name:password@backendlessons.uoknb.mongodb.net/db1?retryWrites=true&w=majority'
mongoose.connect(process.env.MONGO_URI,{useNewUrlParse:true, useUnifiedTopology:true});
//02 create PersonModel
const Schema = mongoose.Schema;
var personSchema = new Schema({
name:{type:String, required:true},
age:Number,
favoriteFoods:[String]
});
var Person = mongoose.model("Person", personSchema);
//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*/);
//};
/** **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 browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; SM-A107F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.111 Mobile Safari/537.36
.
Challenge: Create a Model
Link to the challenge: