mongodb error. how can I solve the erro in mongoDB? mongodb error. how can I solve the erro in mongoDB? mongodb mongodb

mongodb error. how can I solve the erro in mongoDB?


Do you have the mongodb service running? Run sudo service mongod status and see what it returns. If it is stopped, run sudo service mongod start to start the mongodb and try connecting to it.

You can also, check whether the mongodb is listening on 27017 or not by running: sudo netstat -lnp | grep 27017.

If sudo service mongod start is giving a error, you may need to check the configuration. We can help you better if you can post the output of the above commands.

Update:

Create the file /etc/systemd/system/mongod.service with the following content:

[Unit]Description=High-performance, schema-free document-oriented databaseAfter=network.target[Service]User=mongodbExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf[Install]WantedBy=multi-user.target


Just restart the service in terminal, verbose mode helps you to understand the background configuration

$brew services restart  mongodb --verbose

and open another terminal (don't use same terminal) and type mongod, you should be able to see process running.


Excuse have the same problem . Just installed Ubuntu 16.04 LTS . The installation process , the same as in the official website of mongo . When I do:

sudo service mongod status; appear

● mongod.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead)

I guess the error will be in the configuration of "data directory" and the port, but not as configure it properly