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 trialDennis Klarenbeek
17,168 PointsGet no connection to mongod.
I don't get the connection to the Mongodb server because I get the following error:
[MongoError: connect ECONNREFUSED 127.0.0.1:27017] name: 'MongoError', message: 'connect ECONNREFUSED 127.0.0.1:27017' }
I tried to run mongo by starting mongod but I get the -bash: mongod: command not found. Afterwards I tried to mkdir -p /data/db but also this won't solve the problem.
Can somebody help me?
4 Answers
Seth Kroger
56,413 PointsIt depends on how you installed mongo and on what system/OS, but it looks like mongod/mongo wasn't added to your PATH (the list of directories with executable commands that can be run from the command-line).
Charles Li
15,557 PointsDid you figure out how to solve the problem? I'm facing the same error message as well. Thanks!
Charles Li
15,557 PointsI installed with homebrew
Dennis Klarenbeek
17,168 PointsHi Seth,
I have installed MongoDB on the folder and global. I'm using Mac OSx as operating system.
Seth Kroger
56,413 PointsDid you use Homebrew or the manual method? Both described here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
The Machine
10,221 PointsIf you remove the port from the connection string it should work. Based on documentation, the port should work; however, it does not for me either ... investigating why ...
// mongoose.connect('mongodb://localhost:27107/sandbox');
mongoose.connect('mongodb://localhost/sandbox');