Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4490

Mongo DB adapter to support SSL enabled connection and update drivers for Mongo DB client

    XMLWordPrintableJSON

Details

    Description

      Mongo DB Adapter in the current implementation creates a Mongo Client using the below constructor in the class `org.apache.calcite.adapter.mongodb.MongoSchema `

       

       

       MongoSchema(String host, String database,
            MongoCredential credential, MongoClientOptions options) {
          super();
          try {
            final MongoClient mongo = credential == null
                ? new MongoClient(new ServerAddress(host), options)
                : new MongoClient(new ServerAddress(host), credential, options);
            this.mongoDb = mongo.getDatabase(database);
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }

      Where the Mongo Client options are coming from the class `org.apache.calcite.adapter.mongodb.MongoSchemaFactory ` as below

       final MongoClientOptions.Builder options = MongoClientOptions.builder();
      

      This does not allows to pass options to the Mongo Client and it picks up all default options from the builder. 

      I am working on Mongo DB in Cosmos DB in Azure and its SSL enabled and Mongo Clients are by default SSL disabled which prevents me to use this default client. There should be a way to pass client options from the configurations so that Mongo Client can be built with custom properties as specified in the config.

      Along with this the client is being made in the above code snippet using a connection to a single host whereas this does not seems to be the preferred way of making a connection to a cluster. There should be an option to also accept a URL using which a Mongo Client can be made.

       

      Attachments

        Issue Links

          Activity

            People

              shadman.reza Shadman Reza
              shadman.reza Shadman Reza
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m