NEW ISSUE MongoDB and Mongoose - Perform Classic Updates by Running Find, Edit, then Save

Tell us what’s happening:
Keep getting “Find-edit-update an item should succeed” with a terminal message of “Missing done() argument”.

I’ve gone through all the existing posts and none of their solutions help, I even copied and pasted the solution and that still returned the same error

Your code so far

var mongoose = require("mongoose")
require('dotenv').config();
const { Schema } = mongoose;
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });

const personSchema = new Schema({
  name : { type: String, required: true},
  age : Number,
  favoriteFoods : [String]
}, {
  usePushEach : true
});

let Person = mongoose.model("Person", personSchema);

const createAndSavePerson = (done) => {
  var josephHollingworth = new Person({name: "Joseph Hollingworth", age: 23, favouriteFoods: ["Pizza", "Steak", "Ice Cream"] });
  
  josephHollingworth.save(function(err, data) {
    if (err) return console.error(err);
    done(null, data);
  });
};

var arrayOfPeople = [{name: "Joseph Hollingworth", age: 23, favouriteFoods: ["Pizza", "Steak", "Ice Cream"]}, {name: "Joe Holl", age: 24, favouriteFoods: ["Pizza", "Steak", "Soup"]}, {name: "Sepy Bear", age: 2300, favouriteFoods: ["Kitten", "Mice", "Honey"] }]

const createManyPeople = (arrayOfPeople, done) => {
  Person.create(arrayOfPeople, function(err, people) {
    if (err) return console.error(err);
    done(null, people);
  });
};

var personName = "Sepy Bear"

const findPeopleByName = (personName, done) => {
  Person.find({name: personName}, function(err, person){
    if (err) return console.log(err);
    done(null, person);
  });
};


const findOneByFood = (food, done) => {
  Person.findOne({favoriteFoods: food}, function(err, data) {
    if (err) return console.log(err);
    done(null, data);
  });
};

const findPersonById = (personId, done) => {
  Person.findById(personId, function(err,data) {
    if (err) return console.log(err);
    done(null, data);
  });
};

const findEditThenSave = (personId, done) => {
  const foodToAdd = "hamburger";
  
  Person.findById(personId, function(err, data) {
    if (err) return console.log(err);

    data.favoriteFoods.push(foodToAdd);
    
    data.save(function(err, data) {
      if (err) console.log(err);
      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;

My Glitch is here: https://glitch.com/edit/#!/general-sponge-axolotl

Your browser information:

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

Challenge: Perform Classic Updates by Running Find, Edit, then Save

Link to the challenge:

Hello,

I recall reading somewhere that using mongoose with arrow functions was a bad idea as arrow functions were changing the scope of “this”.

Maybe try writing all of your functions without using arrow functions.

Thanks, I’ve given this a try but still getting the same error.