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

Document how to use connection string with multiple credentials

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0
    • Component/s: Documentation
    • None

      The MongoClient constructor in Java currently has:

      MongoClient(MongoClientURI uri)
      MongoClient(List<ServerAddress> seeds, List<MongoCredential> credentialsList, MongoClientOptions options
      

      The former allows connecting using a URI, which is standard and supported by all drivers, but doesn't support custom credentials per database.

      Previously we had API like:

      mongoClient.getDB(dbname).authenticate(...)
      

      ... authenticate seems to have been removed from the 3.x Java driver. But is still avail in other drivers (e.g. pymongo).

      We've read:
      http://mongodb.github.io/mongo-java-driver/3.2/driver/reference/connecting/authenticating/
      https://docs.mongodb.org/manual/reference/connection-string/

      But this seems to deal with single credentials for a Mongo instance.

      What's the recommended way of using multiple database credentials with the Java driver?

            Assignee:
            Unassigned Unassigned
            Reporter:
            jblackburn James Blackburn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: