How should I fix to pass this section?

It does not pass no matter how I fix it. I tried the remove method(deleteOne, deleteMany, remove), and I saw the corresponding data was deleted in the database, but it does not pass anyway. I checked the hint, nothing differnent from my code. How should I fix?

Your project link(s)

solution: boilerplate-mongomongoose-1 - Replit

Your browser information:

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

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

Link to the challenge:

Your code:

Person.deleteOne({name:nameToRemove} ...

Expected as defined in the assignment:

Modify the removeManyPeople function to delete all the people whose name is within the variable nameToRemove , using Model.remove()

MongoDB and using Mongoose APIs have different methods to perform any CRUD operation (in this case deleting a document from the collection). In this assignment you are asked to use a specific method, Model.remove.

NOTE that Model.remove deletes all matching documents, while
Model.deleteOne deletes the first matching document (deletes at most one document only).

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