Challenge Delete Many Documents with model.remove() not working

Tell us what’s happening:
I’m having troubles when trying do validate this challenge.
My code seems good, but I’m receiving the following error in console:

node v12.16.1
OPTIONS
POST
(node:1740) [MONGODB DRIVER] Warning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
JSON.stringify(response) object dump: {"deletedCount":2}
SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)
    at /home/runner/boilerplate-mongomongoose/server.js:346:29
    at /home/runner/boilerplate-mongomongoose/node_modules/mongoose/lib/model.js:4931:18
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

I’m just dumping the jason object and it seems to be right.

Anybody could help me to find the error?

Thanks

Your project link(s)

solution: https://replit.com/@rodrigoam/boilerplate-mongomongoose

Your browser information:

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

Challenge: Delete Many Documents with model.remove()

Link to the challenge:

If I switch to the version of mongoose that is shown in the Install and Set Up Mongoose challenge I pass the test.

Thanks for the tip and to the solution!

1 Like