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

MongoDB Atlas CommandNotFound with Updated Go Driver

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Connections
    • None

      I didn't have any problem till updating mongodb go driver today. This is the connection:

      connInfo.Url is the URL of MongoDB Atlas gives me and username and password are replaced

      ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
      client, error := mongo.NewClient(options.Client().ApplyURI(connInfo.Url))
      checkError(error)
      //Call the connect function of client
      error = client.Connect(ctx)
      checkError(error)
      //Checking the connection
      error = client.Ping(context.TODO(), nil)
      if error != nil {
         log.Fatal(error)
      }
      
      fmt.Println("Connected to MongoDB!")
      

      Result:

      2019/05/09 19:42:29 Defaulting to port 8080
      2019/05/09 19:42:29 Listening on port 8080
      2019/05/09 19:43:07 server selection error: server selection timeout
      current topology: Type: ReplicaSetNoPrimary
      Servers:
      Addr: mongodev-shard-00-01-hs9hf.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: (CommandNotFound) command not found
      Addr: mongodev-shard-00-02-hs9hf.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: (CommandNotFound) command not found
      Addr: mongodev-shard-00-00-hs9hf.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: (CommandNotFound) command not found
      exit status 1
      

      It was working before go get -u go.mongodb.org/mongo-driver/mongo

            Assignee:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Reporter:
            canartuc@gmail.com Can Artuc
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: