[JAVA-2137] Deprecate Mongo property mutators Created: 03/Mar/16  Updated: 19/Oct/16  Resolved: 18/Mar/16

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 3.3.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-2135 MongoClient object accepts setWriteCo... Closed

 Description   

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


 Comments   
Comment by Githook User [ 18/Mar/16 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-2137: Deprecate property-mutating methods in Mongo class:

Generated at Thu Feb 08 08:56:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.