Newbie - Please help I broke mongodb

I am very new using mongo and coding in general. I am taking a udemy course learning a little about mongodb. The initial section worked fine and I had no issues installing in the terminal. After a few sections it just stopped working when I typed in Mongod a bunch of errors were popping up and it was shutting down when initiated. I tried googling all day thursday until I eventually just tried to remove it from my Mac (Big Sur) and reinstall it because I have no clue to what to even ask. That some how made it much worse because now when I type in commands it says the commands don’t exist. Mongo config file doesn’t exist and I don’t know how to get all the files back. I am on day 3 now and I tried leaving a comment on the course video and even on their discord but no one was able to help me. I don’t even know where to begin with what is wrong. I followed along a website to uninstall mongo and after everything seemed to be uninstalled, when I went to go reinstall mongodb it says it is already installed on my computer but I think it is missing some config files and the data folder. I know this is super vague but if anyone could help me that would be awesome, I don’t know who to talk to about my problem or if this is even the correct place to seek help.

Welcome to the community!

It could be PATH issue if you are getting command not found assuming mongo is installed
Check if mongodb/bin shows up in your PATH or not
echo $PATH

cd to mongodb/bin directory and run mongo --version

Hi @base_az, welcome to the community!
Can you please post a screenshot of errors that you are getting while running the mongod command?
Also, can you please run the following command in your terminal and paste the output as well?

pgrep mongod

I am not sure, but maybe your mongod is already running, and you are not able to launch a new mongod(Mongo Daemon) process on your machine since the port is already busy.

In case you have any doubts, please feel free to reach out to us and we will be more than happy to help you.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Hello, thank you for your help. I ended up getting it to start loading again but it still wont boot up. I typed in pgrep Mongod and nothing came back. Here is the result of trying to boot up Mongod now.

It says /data/db dir not found
Give another dir path and check

mongod --dbpath new_path (say your home dir)

or change your config file to use a path where mongod can read/write
Also in Macos they removed access to root folder /data/db
Please check documentation.You have to use a different path for dbpath

I will give it a go. Thank you for your help.

I am still getting some errors. I switched the dbpath and I made sure it was changed in the mongo.conf file. I also have this “disabled” in the mongo shell when trying to connect. This is what was happening to me last week before I uninstalled and had trouble even booting. I googled so much and tried a lot of stuff but I am so new to mongo or even using the terminal it is very overwhelming.

The error says address already in use

When you run mongod without --port param it tries to bring up on default port 27017
Looks like you have another instance already running on this port

You can try to bring up your mongod on a different port

mongod --port 28000 --dbpath your_path bind_ip
Please note when you try to connect to mongod you have to specify the port if you brought up mongod on a different port other than default

mongo --port your_port

Please check documentation for the warning messages you got like access control etc
To secure your mongod you have to use auth parameter

Suggest you to enroll to Mongo university free online courses