Unable to pass the test although my code is right

Tell us what’s happening:
My code

const removeManyPeople = (done) => {
  const nameToRemove = "Mary";
  Person.deleteMany({name:nameToRemove}, (err, data) => {
    if(err) return console.log(err);
    done(null, data);
  })
}

Error

node:998) [MONGODB DRIVER] Warning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
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:4919:18
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

I first used the remove() as on the challenge but after this warning I used the deleteMany() but still the test is unable to complete. Please help me with this challenge

Your project link(s)

solution: https://boilerplate-mongomongoose.atrichakraborty.repl.co

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

Challenge: Delete Many Documents with model.remove()

Link to the challenge:

1 Like

For whatever reason your repl is not loading for me, so I cannot check for myself, but make sure you have the exact versions of mongoose and mongodb that FCC recommends installing here at the bottom.

Hope it helps :sparkles:

1 Like

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