Stuck with remove method mongoose

Tell us what’s happening:

even when I coded exactly with the introduction and hint but cannot pass the challenge someone can help me pleased, I’m very grateful for that

Your project link(s)

solution: http://localhost:3000

Your browser information:

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

Challenge: Delete Many Documents with model.remove()

Link to the challenge:

FYI, we can’t access your localhost. It looks like you have syntax error that may not be related to the remove method. I would need to see more code to help, not a screen shot, link to actual code.

hi now I’m very depressed to fix this bug, I had seen a video about this challenge, problem is not about remove method because I copied exactly what this youtuber coded to pass but still can’t pass, it said that have the problem with file
server.js and now I’m really dreadful if u can help me, I’m really greatful

1 Like

thanks you a lot. Here is link to my git you can see my whole code: GitHub - nguyencongtanphat/mongoDB_mongoose_Exercise
I look forward to receiving response from you

The first things I noticed in myApp.js:

  1. This does not answer your question but is very important. Your mongoDB connection string should never be visible in your GitHub code.
mongoose.connect("no one should ever be able to see this connection string")

Instead your connection string should be saved in a .env file, and in a .gitignore file (you should add one) add .env to be ignored so no one can see your connection string.
Then you would do something like:

  1. The next thing I noticed which might be causing errors you may not expect is this:
favoriteFoods:['chicken, fish, meat, fruit']

You have this in multiple places in your code. Look at this array closely. Is that how you really want your array structured?

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