Add the ability to distinguish between an explicit write concern of {w : 1} and an acknowledged write concern that means to use the server's default

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 3.2.0
    • Affects Version/s: 3.0.3, 2.13.3
    • Component/s: Write Operations
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The driver should add the ability to distinguish between an explicit write concern of

      {w : 1}

      and an acknowledged write concern that means to use the server's default. MongoClient instances by default should use the latter, as per specification.

      This can be done with a small backwards breaking change. We can add a no-argument constructor to WriteConcern which means "this is acknowledged but it should use the server's default configured write concern. And then we can change the declaration of WriteConcern.ACKNOWLEDGED to:

      public final static WriteConcern ACKNOWLEDGED = new WriteConcern();
      

      The only breakage is that with this change, the following code

          WriteConcern.ACKNOWLEDGED.getW()    // getW() returns an integer
      

      will throw an exception, since w will be null rather that an integer.

      In addition, the driver should add additional constants to WriteConcern, e.g.

      public final static WriteConcern W1 = new WriteConcern(1);
      public final static WriteConcern W2 = new WriteConcern(2);
      public final static WriteConcern W3 = new WriteConcern(3);
      

              Assignee:
              Jeffrey Yemin
              Reporter:
              Jeffrey Yemin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: