Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.26.0
-
None
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
- links to