MongoDB and Mongoose - Delete Many Documents with model.remove()

Tell us what’s happening:
I can’t solve that challange and i get back error that say that is collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.

Your project link(s)

solution: Join ARMMM96's "boilerplate-mongomongoose" - Replit

Your browser information:

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

Challenge: MongoDB and Mongoose - Delete Many Documents with model.remove()

Link to the challenge:

@camperextraordinaire I was unable to reproduce an automatic package addition.

Do you remember doing anything specific?

I removed the original mongoose and i have installed the older version according to one of the answers here, but it didn’t work as well,
I didn’t install validator but what is the problem with other packages, what is the correlation with mongoose ? why it won’t do the delete request to the data base?

no i didn’t do that i just returned back to older version of mongoose

I’ve created a new project but still the same problem with Model.remove() method

Link : Join ARMMM96's "boilerplate-mongomongoose (1)" - Replit

I have started the project again all actions are working
but the only function that it dons’t work is Model.remove() or emoveManyPeople
is why the site don’t want to accept it ?

I see this error

E11000 duplicate key error collection: test.people index: name_1 dup key: { name: “Mary” }

I think you may have had the name in the schema set to unique at one point. Delete the collection and try again.


If I use your current code with my own DB it passes the test.

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