Mongoose Model.remove()-Issues

Tell us what’s happening:
I’m getting an alert that model.remove() is deprecated.
So far, so good. When downgrading to mongoose ~4.x.x, it’s still not working.
Changing the method to deleteMany() or so doesn’t solve the exercise, but I think it should…
Now, anyway, this is the code I’ve been using so far.

Your code so far

const removeManyPeople = (done) => {
const nameToRemove = “Mary”;
Person.remove({name: nameToRemove}, (err, response) => {
if(err) return console.log(err);
done(null, response);
})
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0

Challenge: Delete Many Documents with model.remove()

Link to the challenge:

Use the exact version as asked for on the first challenge mongoose@~5.4.0

You can do it from the Terminal tab

npm rm mongoose
npm i -E mongoose@5.4.0

Please also post a link to your Replit.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.