thanks for being here, to be fair I do have a solution, but its a temporary one. Its repetitive and kinda annoying doing it everytime you switch on your pc. So if someone has a more permanent solution to this, please upload it here.
The error looks like this:
`MongoDB shell version v4.4.6 connecting to: mongodb://127.0.0.1:27017/? compressors=disabled&gssapiServiceName=mongodb Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:374:17 @(connect):2:6 exception: connect failed exiting with code 1`To those facing the same problem, I would add the temporary solution in the comments.
1 Answer
the temporary solution is, do this after a "sudo su":
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
sudo service mongod restart