'Remove' mongoose method throws Unexpected token o

I am trying to complete Delete Many Documents with model.remove() challange in FCC.

When i try and submit the solution link, the test fails and console in my replit shows a SyntaxError: Unexpected token o in JSON at position 1

My code:

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

Your project link(s)

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

Your browser information:

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

Challenge: Delete Many Documents with model.remove()

Link to the challenge:

1 Like