Tell us what’s happening:
Describe your issue in detail here.
I’m getting this warning in the console, so far using replit has worked up to this challege. this seems like a possible error in the testing code, because it doesn’t refer to my script, and when I paste the solution in place of my own code, it gives the same error.
(node:1269) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Here is my code commented out with the solution code active. I get the same error for both, and as far as I can tell, my code is identical to the solution:
const createManyPeople = (arrayOfPeople, done) => {
// var peopleObj = [{name: 'Nancy', age: '55', favoriteFoods: ['ice cream', 'oreos']},
// {name: 'Grace', age: '22', favoriteFoods: ['beer', 'hamburgers']},
// {name: 'Peeta', age: '16', favoriteFoods: ['slugs', 'bread']}
// ]
// Person.create(function(err,data){
// if (err) return console.err(err)
// done(null, peopleObj)
// })
/** 4) Create many People with `Model.create()` */
var arrayOfPeople = [
{name: "Frankie", age: 74, favoriteFoods: ["Del Taco"]},
{name: "Sol", age: 76, favoriteFoods: ["roast chicken"]},
{name: "Robert", age: 78, favoriteFoods: ["wine"]}
];
var createManyPeople = function(arrayOfPeople, done) {
Person.create(arrayOfPeople, function (err, people) {
if (err) return console.log(err);
done(null, people);
});
};
};
Your project link(s)
solution: boilerplate-mongomongoose - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge: MongoDB and Mongoose - Create Many Records with model.create()
Link to the challenge: