-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Go Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Summary
Currently, the Go Driver v2 keeps Database-level settings (e.g. readConcern, readPreference, writeConcern, etc) private. Users may occasionally need to retrieve those settings. For example, when trying to construct a runCommand with "readConcern" the same as on the Database object.
The following methods from v1 were removed in PR #1497
- Database.WriteConcern()
- Database.ReadConcern()
- Database.ReadPreference()
- Client.Timeout()
With the reason given:
those values were exposed specifically to support GridFS because it was in a separate package. Now that it's in the mongo package, those do not need to be exposed to support GridFS.
The concern was that exposing a subset of accessors leaks internal state and creates an inconsistent API surface. Users will wonder why some database options are accessible but others aren't. Additionally, future driver changes (e.g. default normalization or added options) could render those getters misleading or out-of-sync.
Definition of Done
Compile a list of ways to uniformly expose a database configuration for users. Current alternatives:
- Define method signatures for each configuration (e.g. ReadConcern(), ReadPreference(), WriteConcern(), etc)
- Use a Database.Config() method to return a struct / options used to create the Database object.
Determine the best solution (if any) and open a POC PR for team review. Otherwise close this ticket as a placeholder with rejection reason.
- related to
-
GODRIVER-2726 Merge the "gridfs" package into the "mongo" package
-
- Closed
-