I am working on Ubuntu OS 16.04. I am starting mongodb using commands::
sudo service mongod start
and then
mongo
It generated this error for m
mongod --repair worked for me ,
sudo mongod --repair
sudo mongod
Then open a different tab/terminal:
mongo
After this your local setup will work properly
This error occurs when your mongodb server
is not running on 27017
port.
Try the below command to start the mongodb server.
sudo systemctl start mongod
And after running this command run the mongo
command.
On MacOS , I executed the 4th step of this
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x-tarball/
tutorial with sudo
sudo mongod --dbpath /usr/local/var/mongodb --logpath /usr/local/var/log/mongodb/mongo.log --fork
and It worked!
MAC: For my case I forgot to turn on mongo server locally, so I fixed the issue by firstly open a new tab on terminal then turn on mongodb server like so: -
mongod
After that just try to open mongo shell again like so: -
mongo
Finally it worked!
Windows
And you are good to go.
i too got the same problem.here is the way how i resoleved.go to taskmanager.select>services and find mongodbserver in the list make sure the mongodb is running by selecting it.
image source