This question is for Linux, but for fellow windows users who found their way here and want a windows solution...
the problem is your Mongodb service is stopped.
So do the following steps:
1) cntrl-alt-del and open your task manager
2) click on 'services'
3) scroll down to MongoDB
4) right click and hit 'start' (or 'restart')
go back to ...
I also ran into same issue. But was able to resolve by completely removing mongo first
sudo apt-get purge mongodb-org*
Then performing following
sudo apt update
sudo apt install -y mongodb
sudo systemctl status mongodb
You can refer to following link for the same: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04
If the problem is related to a remote access, here is the solution for anyone who has the problem
show iptable rules line numbers
sudo iptables -L --line-numbers
The output will be something like this
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere ctstate RELATED,...