MongoDB Documentation, Release 3.0.4 Ruby The recent versions of the Ruby driver have support for connections to SSL servers. Install the latest version of the driver with the following command: Then connect to a standalone instance, using the following form: Replace connection with the following if you’re connecting to a replica set: Here, mongod instance run on “ localhost:27017 ” and “ localhost:27018 ”. For more details, see the Ruby MongoDB Driver page$^{45}$. In the node-mongodb-native 46 driver, use the following invocation to connect to a mongod or mongos instance via SSL: To connect to a replica set via SSL, use the following form: For more details, see the Node.JS MongoDB Driver page$^{47}$. As of release 1.6, the .NET driver supports SSL connections with mongod and mongos instances. To connect using SSL, you must add an option to the connection string, specifying ssl=true as follows: $^{45}$https://docs.mongodb.org/ecosystem/drivers/ruby $^{46}$https://github.com/mongodb/node-mongodb-native $^{47}$https://docs.mongodb.org/ecosystem/drivers/node-js 349 6.3. Security Tutorials The .NET driver will validate the certificate against the local trusted certificate store, in addition to providing en- cryption of the server. This behavior may produce issues during testing if the server uses a self-signed certificate. If var db1 = new Db(MONGODB, new Server("127.0.0.1", 27017, { auto_reconnect: false , poolSize:4, ssl: true } ); connection = MongoReplicaSetClient.new(['localhost:27017'], ['localhost:27018'], :ssl => true ) require 'rubygems' require 'mongo' connection = MongoClient. new ('localhost', 27017, :ssl => true ) gem install mongo Node.JS ( node-mongodb-native ) var replSet = new ReplSetServers( [ new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), ], {rs_name:RS.name, ssl: true } ); .NET var connectionString = "mongodb://localhost/?ssl=true"; var server = MongoServer.Create(connectionString);