Deleting via model.remove() not working, showing error as model.remove()

Tell us what’s happening:
I’m trying to delete using model.remove()as mentioned in my code in below link. But i’m getting this error, even I checked i couldn’t find any Syntax error.

SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse ()
at /home/runner/boilerplate-mongomongoose/server.js:346:29
at /home/runner/boilerplate-mongomongoose/node_modules/mongoose/lib/model.js:4994:18
at processTicksAndRejections (internal/process/task_queues.js:79:11)

Your project link(s)

solution: 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/102.0.5005.63 Safari/537.36 Edg/102.0.1245.39

Challenge: Delete Many Documents with model.remove()

Link to the challenge:

May not be relevant, but I noticed you are not using version mongoose@~5.4.0 in your package.json. Try changing and running npm install to see if that helps.

The remove method was deprecated sometime before version 6.3.8, which is why things are not working as you expected.

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