Delete Many Documents with model.remove() is not Passing Challenge Code

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) {

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:

Unfortunately, it looks like to pass this one, you need to reinstall older versions of MongoDB and Mongoose… the ones given at the beginning of this section. I had same issues and when I switched back to the older versions, it passed the test

It is just amazing to see that the challenge was completed with the same code. Thanks for sharing your experience here.

Two additional cmd used:

npm install mongodb@~3.6.0 and npm i mongoose@~5.4.0

I hope others will also get some hints from this discussion.


Thanks @niteshthemerndev! For anyone using the Replit version like me, you cannot use the package manager to get these older versions of mongodb and mongoose. You must run these commands manually in the Shell pane :+1:

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