Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2953

Make setting journaled=true on a write concern easier

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown 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.

            Assignee:
            timothy.kim@mongodb.com Timothy Kim (Inactive)
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: