I’m trying to connect to via my code in golang. I am using the mongo-driver module. I am able to connect to instance:
mongodb+srv://<username>:<password>@cluster0-0pjmx.mongodb.net/test?retryWrites=true&w=majority
But on this line:
insertResult, err := collection.InsertOne(context.TODO(), entry_one)
I get this panic:
2020/04/18 15:56:55 server selection error: server selection timeout, current topology: { Type: Repl
icaSetNoPrimary, Servers: [{ Addr: cluster0-shard-00-00-0pjmx.mongodb.net:27017, Type: Unknown, Stat
e: Connected, Average RTT: 0, Last error: connection() : connection(cluster0-shard-00-00-0pjmx.mongo
db.net:27017[-179]) incomplete read of message header: EOF }, { Addr: cluster0-shard-00-01-0pjmx.mon
godb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : connecti
on(cluster0-shard-00-01-0pjmx.mongodb.net:27017[-181]) incomplete read of message header: EOF }, { A
ddr: cluster0-shard-00-02-0pjmx.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0,
Last error: connection() : connection(cluster0-shard-00-02-0pjmx.mongodb.net:27017[-180]) incomplete
read of message header: read tcp 192.168.43.131:34958->3.7.51.68:27017: read: connection reset by p
eer }, ] }
exit status 1
Any idea if I am missing something?