I\'m new in nodeJS, started learning by following a trailer on youtube, everything goes well until I added the connect function if mongodb,
mongo.connect(\"m
Your firewall blocked port 27017 which used to connect to MongoDB.
Try to find which firewall is being used in your system, e.g. in my case is csf, config file placed at
/etc/csf/csf.conf
find TCP_IN & TCP_OUT as follow and add port 27017 to allowed incoming and outgoing ports
# Allow incoming TCP ports
TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,2222,27017"
# Allow outgoing TCP ports
TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,2222,27017"
Save config file and restart csf to apply it:
csf -r