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

Implement builder for MongoClientURI (and maybe ConnectionString)

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • Configuration
    • None
    • Fully Compatible

    Description

      Currently MongoClientURI can be created either from String or String + MongoClientOptions.Builder and can't be created from existing MongoClientURI with some alterations.

      I propose adding a builder (public static inner class in MongoClientURI would be OK, I think) with convenience static methods like MongoClientURI.builder() and MongoClientURI.builder(MongoClientURI from).

      Builder itself would have convenient methods like hosts(String...), hosts(List<String>), database(String), collection(String), username(String), password(char[]) and a number of methods for standard options, present in ConnectionString/MongoClientURI.

      If this proposal is acceptable, I'll publish prototype on github.

      Attachments

        Activity

          People

            ross@mongodb.com Ross Lawley
            grossws gross
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: