[GODRIVER-1032] MongoDB Atlas CommandNotFound with Updated Go Driver Created: 09/May/19  Updated: 14/May/19  Resolved: 14/May/19

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

Type: Bug Priority: Major - P3
Reporter: Can Artuc Assignee: Divjot Arora (Inactive)
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by GODRIVER-1038 MongoDB Go Driver does not connect to... Closed
is duplicated by GODRIVER-1039 mongo-go-driver fails with Server Sel... Closed
Related
related to GODRIVER-1042 Don't add read preference for non-mon... Closed

 Description   

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



 Comments   
Comment by Divjot Arora (Inactive) [ 14/May/19 ]

The underlying cause of this issue is described in GODRIVER-1042, so we'll be doing this under that ticket.

Comment by Divjot Arora (Inactive) [ 13/May/19 ]

canartuc@gmail.com We've determined that this is a bug in the master branch of the driver. In the meantime, please use the v1.0.1 release, which you can get via the dep tool by running

dep ensure -add "go.mongodb.org/mongo-driver/mongo@~1.0.0"

We are currently investigating why this is an issue in the master code.

Comment by Dwi Budi Utomo [ 13/May/19 ]

up

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