[GODRIVER-1661] mongodb driver failed to connect to mongodb version 2.4 Created: 22/Jun/20  Updated: 27/Oct/23  Resolved: 22/Jun/20

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

Type: Bug Priority: Major - P3
Reporter: Justin Ma Assignee: Isabella Siu (Inactive)
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

using mongodb driver 1.3.4, connect to mongodb server 2.4.14.

Could not complete the connection, an error occurred:
2020/06/22 12:40:35 server selection error: server selection timeout, current topology: { Type: Single, Servers: [

{ Addr: localhost:24001, Type: Standalone, State: Connected, Average RTT: 784156 }

, ] }

 

The connection missing in select server, after 30s, return the error.

 

mongodb server build info:

// code placeholder
> db.serverBuildInfo()> db.serverBuildInfo(){ "version" : "2.4.14", "gitVersion" : "05bebf9ab15511a71bfbded684bb226014c0a553", "sysInfo" : "Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49", "loaderFlags" : "-fPIC -pthread -rdynamic -m64", "compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64", "allocator" : "system", "versionArray" : [ 2, 4, 14, 0 ], "javascriptEngine" : "V8", "bits" : 64, "debug" : false, "maxBsonObjectSize" : 16777216, "ok" : 1}>

 

golang program:

// code placeholder
// Set client options
clientOptions := options.Client().ApplyURI("mongodb://localhost:24001/admin?connect=direct")
 
// Connect to MongoDB
client, err := mongo.Connect(context.TODO(), clientOptions)
 
if err != nil {
   log.Fatal(err)
}
 
// Check the connection
err = client.Ping(context.TODO(), nil)
if err != nil {
   log.Fatal(err)
}

 

 

 



 Comments   
Comment by Isabella Siu (Inactive) [ 22/Jun/20 ]

Hi kerrigell@gmail.com,

The go driver only supports down to MongoDB version 2.6. We currently have GODRIVER-1659 filed to give clearer errors for unsupported versions.

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