Shadman Reza created CALCITE-4490:
-------------------------------------
Summary: Mongo DB adapter to support SSL enabled connection and
update drivers for Mongo DB client
Key: CALCITE-4490
URL: https://issues.apache.org/jira/browse/CALCITE-4490
Project: Calcite
Issue Type: Improvement
Components: mongodb-adapter
Affects Versions: 1.26.0
Reporter: Shadman Reza
Mongo DB Adapter in the current implementation creates a Mongo Client using the
below constructor in the class `org.apache.calcite.adapter.mongodb.MongoSchema `
{code:java}
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);
}
}{code}
Where the Mongo Client options are coming from the class
`org.apache.calcite.adapter.mongodb.MongoSchemaFactory ` as below
{code:java}
final MongoClientOptions.Builder options = MongoClientOptions.builder();
{code}
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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)