Issue
I am trying to use mongoDB
in Linux mint 19. But I am getting below error.
What is the solution ?
Solution
You're starting the mongo shell client, which by default tries to connect to a mongod server running on localhost and listening on port 27017. However, there is no server listening there so the mongo shell notes that and exits.
You'll need to investigate why there was no mongod server listening there:
- The MongoDB Server package isn't installed
- You're specifying a non-default port in e.g. /etc/mongod.conf
- The mongod process/service is not running
- ...
First verify that the Server package is installed:
sudo dpkg -l | grep -i ".*mongodb.*server"
Then check the status of the mongod service and go from there. That will tell you if it's running, what port it's listening on, what config file is used, etc.
sudo systemctl status mongod
If it's not running then try to start it:
sudo systemctl start mongod
If it's still not running then look at the log messages:
sudo journalctl -u mongod.service
Answered By - Matt Lord