Problem of connection



couldn’t connect to server

Hi, developing a MEAN project. My mongoDB deployment is on and as production I am connection to deployment, as a development connecting to local, actually trying to… As you can see the error, I got the same log after I write
> mongo on Terminal.

warning: Failed to connect to,
Preformatted textreason: errno:111 Connection refused

Error: couldn't connect to server (, connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed

I’d like to connect my localdb and also I wanna manage my deployment on Terminal. However I cannot connect my mongo shell.


I can connect my deployment on mongolab when I try this:

nodemon server.js

nodemon app.js

In these js files, connection string is defined and it both inserts and selects document from deployment on without any errors. Still don’t understand why cannot connect local, mongo shell.


did you try forcing the port to 8081? i know you are not trying to make a web service here, but i have had problems in the past with c9 and sockets other than 8080, 8081


Thanks for reply. May I ask you where to change this information? Because I couldn’t find where it’s written. @Wambosa


is mongo service running?


@harutyun and @Wambosa;

MongoDB service DOES run on deployment but NOESN’T on local, giving the error above. Together with this, interesting, data can be written and read to and from the deployment with my mongolab connection string in app.js file when I type command > nodemon app.js on Terminal. (app.js file has both read, write, findOne methods in its independently)

The connection error occurs when I run the project by either typing > nodemon server.js on Terminal or opening URL on browser like

Also there is another problem that my IDE doesn’t recognize angular definition written on top of js files under controller directory. But that’s another point. Let’s find and fix this up first!


to connect to local mongo shell on, you need to run mongodb service locally.

Also there is another problem that my IDE doesn’t recognize angular definition written on top of js

could you show an example of a file which is not recognized correctly?


Thanks @harutyun, details of my question to 2nd point is as follows:

this is screen from a js file under ‘controller’ directory.

It comes to me that, IDE cannot recognize angular codes so that I cannot display all different .jade/.html files in a single page. I made them to be seen in a single page, however the only thing seen on the page is codes written inside of index.jade file. Normally on top-right corner there must be login panel, but not seen there!

huh, it’s tough at all!


you can add /global angular/ at the top of the file, or add angular to .eslintrc see