It seems that the Socket cannot be connected. You should first check whether the server address given is correct and whether you can connect using Shell.
mongo [ip]:[port]
If it can be connected, it means there is a configuration problem. Otherwise, mongodb may not be started at all, or the listening address may be incorrect. Problems need to be eliminated one by one.
Try to ping localhost
Modify the host file and add 127.0.0.1 localhost
Just restart the service...
Is there a problem with the configuration? Can you post the code for connecting to the database?
It seems that the Socket cannot be connected. You should first check whether the server address given is correct and whether you can connect using Shell.
If it can be connected, it means there is a configuration problem. Otherwise, mongodb may not be started at all, or the listening address may be incorrect. Problems need to be eliminated one by one.