[GODRIVER-1571] Go couldn't connect mongodb 2.4 version Created: 13/Apr/20  Updated: 13/Apr/20  Resolved: 13/Apr/20

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: erol yap?c? Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I couln't connect mongodb with golang.

telnet mongoHost 27017 it is okey

ping mongoHost it is okey

MongoHost is my private host not docker

Mongodb version : 2.4.3

MongoDriver: 1.3.2

Go version: go version go1.14.1 darwin/amd64

Operation System: Mac

Here is my connection code

 

 
clientOptions := &options.ClientOptions{}
clientOptions.SetServerSelectionTimeout(4 * time.Second)
clientOptions.SetDirect(true)
clientOptions.SetAppName("tests")
clientOptions.SetHosts([]string{"mongoHost:27017"})
clientOptions.SetReadPreference(readpref.Secondary())
client, err := mongo.NewClient(clientOptions)
if err != nil {
    log.Fatal(err)
}
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
err = client.Connect(ctx)
if err != nil {
    log.Fatal(err)
} 

 

I changed timeout but It doesn't changed connection every time I got this error:

2020/04/12 14:06:19 server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: mongoHost:27017, Type: Standalone, State: Connected, Average RTT: 13849652 }, ] }
 



 Comments   
Comment by Esha Bhargava [ 13/Apr/20 ]

eroll.yapici@gmail.com The Go driver does not support Mongodb version 2.4. We only support 2.6 and up.

Generated at Thu Feb 08 08:36:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.