|
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
|