Issue
If someone can provide some insights here I would GREATLY appreciate it.
I am new to MongoDB, and (relatively) new to the command line.
I had a express/node.js app running on MongoDB locally successfully, but upon restarting my computer, I attempted to restart the Mongo server and it began giving errors and wouldn't start. Since then, I have re-installed Mongo several times only to find the same error occurring. this is what I am receiving:
privee:mongodb-osx-x86_64-2.4.6 jonlinton$ ./bin/mongo
MongoDB shell version: 2.4.6
connecting to: test
Mon Aug 26 14:48:47.168 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
Am I missing a step? Should I be creating a config file? Some basic guidance would be really helpful. Thanks in advance for any insights.
Solution
Assuming you have created the data/db directory under bin after install.
- Start a terminal for your mongo server
- Go to
<mongodb-install-directory>/bin
directory Run the command
./mongod
Start a terminal for your mongo shell
- Go to
<mongodb-install-directory>/bin
directory Run the command (make sure you put the name of the database)
./mongo test
Answered By - Jesus Ruiz Answer Checked By - Mary Flores (WPSolving Volunteer)