-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Go Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Context
The Ping operation currently requires passing a read preference as the 2nd argument. For example:
client.Ping(context.Background(), readpref.Primary())
No other Go Driver API currently requires specifying a read preference. Furthermore, a read preference is irrelevant for sharded and load-balanced clusters because mongoS responds to the Ping (awaiting confirmation on that). We should do one of the following:
- Add a PingOptions type that allows specifying a read preference.
- Remove the read preference argument and don't allow specifying a read preference for Ping.
Definition of done
What must be done to consider the task complete?
Pitfalls
Ping actually isn't great for checking database connectivity because it doesn't require valid auth. It is possible to Ping a cluster successfully, but fail to read or write data. Maybe deprecating Ping and providing an alternative to check for connectivity and auth would be a better approach.