MongoNetworkError
Node.jsMongoErrorconnectivitynetworking
A network-level error occurred during communication with the MongoDB server
What is happening?
MongoNetworkError indicates that the TCP connection to the MongoDB server was interrupted or could not be established. This is different from MongoServerSelectionError — it means the driver had (or was trying to establish) a connection that failed at the network level. The connection is typically closed and the server is marked as unknown in the topology.
Common causes
- MongoDB server process crashed or restarted
- Network interruption between application and database
- Connection idle timeout on a load balancer or firewall
- Replica set failover causing connection resets
- Atlas maintenance window or scaling event
- TLS handshake failure
- Server closed the connection due to maxIdleTimeMS