I follow all the steps mention in MongoDB installation documents for Ubuntu 16.04
.
Steps 1:
sudo apt-key adv --keyserv
This happened to me while adding users in admin db.
sudo systemctl daemon-reload
is recommended from the official mongo website, but did not help.
If you get
Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.
While executing
sudo systemctl start mongod
run journalctl -xe
and if the issue is
Failed to start MongoDB Database Server.
-- Subject: Unit mongod.service has failed
Then run sudo mongod
--> mongo
This will fix the issue and if you want to run with systemctl
, then terminate the windows for mongod and mongo and run
sudo systemctl start mongod
and then mongo