When you start the MongoDB server, it dynamically creates a socket file, typically named something like mongodb-27017.sock (with 27017 being the default MongoDB port). This file serves as a point of contact for client applications to connect to the MongoDB server, enabling data exchange and query execution.

sudo rm /tmp/mongodb-27017.sock

Restart MongoDB Service
To restart the MongoDB service, you can use the following command

sudo systemctl restart mongodb

Check The Status
``sudo systemctl status mongodb`