Model.remove is deprecated, can't pass the test with alternatives

Tell us what’s happening:

I need to delete many documents with Model.remove() query of Mongoose

But, Model.remove() is deprecated Mongoose v6.2.1: Deprecation Warnings

and thus npm shell is throwing an error (deprecated) when fcc tries to test my localhost

Tried to use deleteOne() and deleteMany() as suggested in the docs, but can’t pass the test.

Is there a way to turn off deprecated error? So that fcc can test it.

or is something wrong with my code?

Code:

const removeManyPeople = (done) => {

  const nameToRemove = "Mary";

   Person.remove({name: nameToRemove}, (err, removedItems) => {

    if(err) {

      done(err)

    } done(null, removedItems)

  })

      
};

Your project link(s)

solution: http://localhost:3000

Your browser information:

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

Challenge: Delete Many Documents with model.remove()

Link to the challenge:

1 Like

I can’t see your code, but …

“depricated” means that it is not supported in future versions. That doesn’t mean that it is not valid in past versions. In software development, we don’t necessarily jump onto the latest version - a lot of bugs can be created that way. We don’t really care if it is deprecated in newer versions until it is time to move up to a newer version.

Please confirm that you are using the suggested version of the library.

1 Like