Fixing MongoDB Connection Refused
MERN stack developers often face this. It means your Node app cannot find the database on port 27017.
1. Check mongod status
Run the daemon command to see the live logs.
mongod
2. Delete Lock File (If crashed)
If Mongo crashed improperly, a lock file might prevent restart.
rm /data/db/mongod.lock