I modified the removeManyPeople
function to delete all the people with the name stored in the variable nameToRemove.
I used async and await but it didn’t work out. And Later I tried the exact code which was available in the Help section.
But the code is not getting passed.
Can you please help me identify what is the issue?
My code:
const removeManyPeople = async (done) => {
const nameToRemove = 'Mary';
try {
const result = await Person.remove({ name: nameToRemove });
done(null, result);
} catch (err) {
console.error(err.message);
}
};
In the log, I see the below error:
SyntaxError: Unexpected token o in JSON at position 1 at JSON.parse (<anonymous>) at C:\Users
** Used localhost link**
solution: http://localhost:3000
Challenge: Delete Many Documents with model.remove()
Link to the challenge: