-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: 1.12.0
-
Component/s: Read and Write Concern
-
None
The new API for creating a write concern (added in v1.12.0) makes defining write concerns like "w:majority, j:true" somewhat awkward. It requires users to set the Journal field, which is a *bool. Go does not have a syntax for bool pointer literals, so you have to write
writeConcern := writeconcern.Majority() j := true writeConcern.Journal = &j
or
writeConcern := &writeconcern.WriteConcern{ W: writeconcern.Majority().W, Journal: writeconcern.Journaled().Journal, }
This is a feature request from https://github.com/mongodb/mongo-go-driver/pull/1331.
Definition of done:
- Improve the API for enabling journaling on write concerns.
- is related to
-
GODRIVER-2685 Simplify "writeconcern" API
- Closed
- related to
-
GODRIVER-2954 Make defining a "majority" write concern literal easier
- Closed