while trying this mongo command in ubuntu I am getting this error.
ritzysystem@ritzysystem-Satellite-L55-A:~$ mongo
MongoDB shell version: 2.6.1
For mongo v3.6.3+ (or 2019 versions)
rm /var/lib/mongodb/mongod.lock
service mongodb restart
In my case bind_ip was not 127.0.0.1 in /etc/mongodb.conf file so change bind_ip to 127.0.0.1(it may be comma separated values so make sure 127.0.0.1 is one of them) Then restart your system to take effect. Restart only to the those who are facing
$sudo service mongod restart
Failed to restart mongod.service: Unit mongod.service not found.
I solved that simply by entering sudo mongo
after mongod
command.