Delete Many Documents with model.remove() cant pass

I have downloaded “mongoose”: “^6.0.3”. I solved the test but at the end i take error ** Warning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.**My code is like that


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

I also uninstall the version 6.0.3 and changed it with old version.But still failed.

Can you confirm that you tried the following versions in your Package.json? If not, could you try with these versions and see if you are still having the same issue.

“mongodb”: “^4.1.1”,
“mongoose”: “^5.13.8”

3 Likes

i tried your version, and it worked well thanks

1 Like

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