The MongoDB server mongod listens on port 27017/TCP. Since MongoDB 3.6 the official packages bind to localhost only by default (net.bindIp in mongod.conf). Access control is not automatically on, though: it must be enabled with security.authorization: enabled.
Do not open it to the internet. Exposed MongoDB instances without authentication have repeatedly been wiped and held for ransom. If remote access is needed: enable authentication, set bindIp to the internal address, allow only app servers and use TLS. For admin access an SSH tunnel is simpler: ssh -L 27017:127.0.0.1:27017 admin@db.example.com.
Typical: the app reports "connection refused" because bindIp only contains 127.0.0.1, or "Authentication failed" because the user was created in another database (authSource).
Check
mongosh "mongodb://db.example.com:27017" --eval "db.runCommand({ping:1})"