Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-780

Expose MongoClientURI constructor for overriding default options

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.11.0
    • 2.10.1
    • API
    • None

    Description

      Overview: Making a case for this constructor to be public:

      https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/MongoClientURI.java#L162

      Within the MMS server implementation, we have a use case where MongoDB connections are configured via MongoURIs. And, we have application-specific default options that want to take precedence over the driver defaults.

      In the past, this was easy enough since MongoURI and MongoOptions were both mutable. However now that MongoClientURI and MongoClientOptions are both immutable, I'm struggling for how to implement the same behavior without going through a deprecated alternative.

      Fwiw, it appears that what I'm looking for exactly is the package private constructor linked above, which would allow me to specify my own set of default options.

      (Encountered using 2.11.0-SNAPSHOT at githash 1d2e6faa80aeb5287a26d0348f18f4b51d566759, but looks unchanged on master.)

      Thanks!

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            john.morales@mongodb.com John Morales
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: