I am getting the error: "failed to connect to [localhost:27017]" while trying to follow this tutorial.
I've been attempting to do several other node.js tutorials with mongoDB over the past few days, and each one runs into similar problems. The other solutions I've found surrounding this all involve people not having the server running when trying to connect. I have mongod running in a terminal window, can view the info in the browser at localhost, and have added and viewed records to the database through the mongo shell. All of that appears to be working. The breakage seems to be in connecting any of the node.js projects to the database, but being pretty new to this, I am not even sure where to begin troubleshooting.
RESOLVED: very stupid mistake on my part. The file suggested by Neil below (view here was instrumental in helping me to troubleshoot and find the problem, though.
needed to change the line
mongoose.connect('mongodb://localhost/MyApp');
to
mongoose.connect('mongodb://127.0.0.1:27017/test');
in the server.js file.
Additional note: for reasons I don't quite understand, specifying the address as 127.0.0.1: works, but localhost: does not.