I installed mongodb 7.0.5 it installed successfully. and i run command mongod --version it shows version. ok but
when I try to command mongosh it shows "MongoServerSelectionError: connection to 127.0.0.1:27017 closed"
I saw some videos in youtube and they are saying open services and start the mongodb I try it but when I click start it starts to run but suddenly show this image this box is showing when I started services in box it says that: windows could not start the MongoDB Server (MongoDB) on Local Computer.For more information,review the system Event Log.if this is a non-Microsoft service,contact the service vendor,and refer to service-specific error code 48
--when i open mongod.log i saw like this in 7 rows {"t":{"$date":"2024-02-18T14:43:42.788+05:30"},"s":"E", "c":"CONTROL", "id":20568, "ctx":"initandlisten","msg":"Error setting up listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"setup bind :: caused by :: An attempt was made to access a socket in a way forbidden by its access permissions."}}}
--is it the problem of any firewall security options --and I noted one more thing that in my mongodb folder server/7.0/data inside it there is nothing but when i installed it on my friend pc there are many files is it any problem that there is no files in my folder
Please help me to crack it it been one year that I have been trying to solve this problem.
My laptop is Dell inspiron15
SOLUTION: the problem is my port 27017 is already connected with node.exe so i first kill this PID and i start the MongoDB service it started and i run mongosh in cmd it connected to the port
Make a double-click on the service. There you can see the Path to EXEC command, e.g.
Open the configuration file with e text editor and have a look at
Open this logfile, there you should find a message why your MonogDB does not start.
In case the logfile is empty, you can try to start the MongoDB manually, i.e. run the command
from a command line window.