Deprecate Mongo property mutators

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 3.3.0
    • Affects Version/s: None
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Since MongoDatabase instances are immutable, it's quite confusing to have mutable Mongo/MongoClient properties that have no effect on MongoDatabase/MongoCollection instances. In particular,

      MongoClient client = new MongoClient();   // w : 1
      client.setWriteConcern(WriteConcern.REPLICA_ACKNOWLEDGED);
      MongoDatabase database = client.getDatabase();  // w : 1
      database.insertOne(new Document(...));   // still w : 1
      

      This is different than the behavior of the now-deprecated Mongo#getDB method.

      So we should document this, and at the same time deprecate the following methods on Mongo:

      • setReadPreference
      • setWriteConcern
      • setOptions
      • resetOptions
      • addOption
      • getOptions

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

                Created:
                Updated:
                Resolved: