Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1661

mongodb driver failed to connect to mongodb version 2.4

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.3.4
    • Component/s: Connections
    • Labels:
      None

      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)
      }
      

       

       

       

            Assignee:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Reporter:
            kerrigell@gmail.com Justin Ma
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: