Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Mongo Basics Getting Started With MongoDB Setting Up MongoDB

Anthony c
Anthony c
20,907 Points

Getting error with mongo command

MYNAME-MacBook-Air:~ MYNAME$ mongo
MongoDB shell version: 3.2.0
connecting to: test
2015-12-29T16:32:25.605-0500 W NETWORK  [thread1] Failed to connect to, reason: errno:61 Connection refused
2015-12-29T16:32:25.608-0500 E QUERY    [thread1] Error: couldn't connect to server, connection attempt failed :

exception: connect failed

3 Answers

jason chan
jason chan
31,008 Points

you have to run two terminals

one for mongod first as server
second mongo as shell

I hope this help someone.

Michael Watson
Michael Watson
Treehouse Teacher

I had some issues with this myself. Try rewatching from 2 mins, and considering the advice from Anthony c and Jason Chan as both were helpful comments as I troubleshot locally. It's working for me now. Also, I had to run


in one terminal first, then


in the next and it worked.

Thanks Anthony!