-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Connections
-
None
I connect to my mongodb server like this:
client, _ := mongo.NewClient(options.Client().ApplyURI("mongodb://my_username:my_passwd@my_host:27017/my_db"))
ctx, cancelFunc := context.WithTimeout(context.Background(), 10*time.Second)
defer cancelFunc()
_ = client.Connect(ctx)
err = client.Ping(ctx, nil)
But no matter what password I enter correctly or incorrectly, Ping will not get an error.
So how can I find this error before I operate my mongo?