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

Make defining a "majority" write concern literal easier

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.0.0
    • Affects Version/s: 1.12.0
    • Component/s: Read and Write Concern
    • None
    • Major Change
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      The new API for creating write concerns (added in v1.12.0) only includes a single way to create a write concern with w:majority: the writeconcern.Majority convenience function. If users want to define a write concern literal for w:majority, ..., they have to define their own string:

      j := true
      writeConcern := writeconcern.WriteConcern{
      	W:       "majority",
      	Journal: &j,
      }
      

      or use the Majority function to get the "w" field:

      writeConcern := &writeconcern.WriteConcern{
      	W:       writeconcern.Majority().W,
      	Journal: writeconcern.Journaled().Journal,
      }
      

      Definition of done:

      • Create a way to define a write concern literal for w:majority, ... without using a literal string or the Majority function.

            Assignee:
            preston.vasquez@mongodb.com Preston Vasquez
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: