Error: couldn't connect to server 127.0.0.1:27017

create a data/db in your home directory

1.cd /Users
2. cd to your home directory
3.mkdir data
4.cd data
5.mkdir db
6. mongod --dbpath ~/data/db press enter then just keep it running.

24 Likes