var findEditThenSave = function(personId, done) {
var foodToAdd = 'hamburger';
Person.findById({_id: personId})
.then(function(person) {
person.favoriteFoods.push(foodToAdd);
person.save(function(err, people) {
if(err) return console.log(err);
done(null, people);
});
})
};
Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save