Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHenry Lay
14,739 PointsTerminal not loading when i typed in mongo
Hi guys,
had a error when i entered mongo command, and for whatever reason I can't seem to get it connected.
here was the error code on my terminal
Henrys-MacBook-Pro:treehouse-mongo-basics henrylay$ mongo MongoDB shell version v4.0.3 connecting to: mongodb://127.0.0.1:27017 2018-11-06T21:35:33.580+1100 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:257:13 @(connect):1:6 exception: connect failed
1 Answer
Ken Alger
Treehouse TeacherHenry;
Do you have the mongod
service running on your local machine on port 27017?
To run the mongo
command successfully and launch an instance of the mongo shell, you'll need to have the actual database running. Without a database to connect to, you'll typically get the error you mentioned.
Post back if you're still stuck.
Ken