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 trial
Pablo Duran
15,052 PointsProblems with Mongo conection.
Hi everyone,
I have an issue with mongo. I installed using brew package manager, as the teacher in the video, however went I try to run the "mongo" command in console I got this error message:
MongoDB shell version: 3.2.9
connecting to: test
2016-10-12T19:50:54.081-0600 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2016-10-12T19:50:54.081-0600 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6
exception: connect failed
I searched on Internet, but I couldn't find a solution, did someone have experienced the same issue? There is a solution for this problem?
Best Regards.
3 Answers
Ken Alger
Treehouse TeacherPablo;
Just to make sure I am not leading you astray, after running the mongod command did you wait for the server to completely start up prior to running the mongo command?
After running mongod it can, depending on your system and database configuration, take a while to get to the point in which the server displays waiting for connections on port 27017 in the logs. Port 27017, by the way, is the default port and may not be the same depending on your particular configuration. If the server does not, or has not yet, displayed that message, there won't be a server for Mongo Shell to connect with.
Post back with further questions and observations,
Ken
Ken Alger
Treehouse TeacherPablo;
Do you have an instance of mongod running on your machine for the Mongo Shell to connect to?
Ken
Pablo Duran
15,052 PointsHi Ken,
I don't know, I just tried to do the same as the treehouse teacher after he installed the mongodb. How can I notice that you are saying?
Regards.
Ken Alger
Treehouse TeacherPablo;
Prior to running the mongo command, you also need to run the mongod command.
The Mongo Shell, which is launched with the mongo command needs to connect to the database server which is started from the mongod command.
Ken
Pablo Duran
15,052 PointsKen,
Thanks for your help, I ran the "mongod" command on console and then "mongo" command, but it still show me the connect failed message. I don't know if I missing something.
Regards.