Check whether the MongoDB server process is running on the target host and note the port it listens on, 27017 by default. Expected: the process is running, or you have found it stopped and can start it.

Compare the host and port in your connection string against the running server. Expected: they match exactly, with no old host name left from another environment.

Test basic reachability to that host and port from the app machine using a TCP connection test. Expected: the connection opens, or it times out and points at a firewall, stopped server, or wrong address.

If you use a replica set connection string, connect directly to the primary with a direct connection option for one test. Expected: a direct connection succeeds if the single server is healthy, which isolates replica set discovery as the failing part.

Check the server names the replica set advertises for itself and confirm the app machine can resolve and reach those names. Expected: every advertised name resolves from the app machine.

Restart the app and retry the original connection string unchanged. Expected: the driver connects and the first query returns a result instead of MongoNetworkError.

Add a short server selection timeout while debugging so failures surface in seconds instead of hanging. Expected: a still broken setup fails fast with the same error and a clear host name.