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

Make setting journaled=true on a write concern easier

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • 1.12.0
    • Read and Write Concern
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: