I can connect to cloud data base but when try connect to local one I got an error

I can connect with compass, but from script got this error:
TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : “1”, ConnectionMode : “Automatic”, Type : “Unknown”, State : “Disconnected”, Servers : [{ ServerId: “{ ClusterId : 1, EndPoint : “Unspecified/localhost:27017” }”, EndPoint: “Unspecified/localhost:27017”, State: “Disconnected”, Type: “Unknown”, HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. —> System.Net.Sockets.SocketException: The address is incompatible with the selected protocol.

I found solution instead of connecting to “mongodb://localhost:27017” I connected to “mongodb://127.0.0.1:27017” and it is different data base when I connect from compass but it is working.

3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.